Commit e296d4fe46012510832d9ac039f2946b622ec2cf

Authored by Leonardo Merlin
2 parents 4d198301 3d88fc18

Merge branch 'master' into staging

src/app/components/a11y-bar/a11y-bar.html
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 </a> 16 </a>
17 </li> 17 </li>
18 <li> 18 <li>
19 - <a class="color-theme-common-fg" accesskey="3" id="skip-to-search" ui-sref="inicio({scroll:'lista-de-programas'})" ui-sref-opts="{reload: true}"> 19 + <a class="color-theme-common-fg" accesskey="3" id="skip-to-search" href="#search" ng-click="focusOnSearch($event)">
20 Ir para a busca 20 Ir para a busca
21 <span class="color-theme-common-bg">3</span> 21 <span class="color-theme-common-bg">3</span>
22 </a> 22 </a>
src/app/components/app-navbar/app-navbar.directive.js 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .directive('appNavbar', appNavbar);
  7 +
  8 + /** @ngInject */
  9 + function appNavbar() {
  10 +
  11 + /** @ngInject */
  12 + function NavbarController($log) {
  13 + $log.debug('NavbarController');
  14 +
  15 + var vm = this;
  16 +
  17 + vm.scrollTo = function(hash) {
  18 + var $el = angular.element('#' + hash);
  19 + angular.element('body').animate({scrollTop: $el.offset().top}, 'slow');
  20 + };
  21 + }
  22 +
  23 + var directive = {
  24 + restrict: 'E',
  25 + templateUrl: 'app/components/app-navbar/app-navbar.html',
  26 + scope: {
  27 + creationDate: '='
  28 + },
  29 + controller: NavbarController,
  30 + controllerAs: 'vm',
  31 + bindToController: true
  32 + };
  33 +
  34 + return directive;
  35 + }
  36 +
  37 +})();
src/app/components/app-navbar/app-navbar.html 0 → 100644
@@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
  1 +<div class="app-navbar">
  2 + <nav id="navigation" class="header-navbar navbar" role="navigation">
  3 + <div class="navbar-header">
  4 + <div class="row">
  5 + <div class="row-height">
  6 + <div class="col-xs-10 col-xs-height col-middle">
  7 + <a class="navbar-brand" ui-sref="inicio">
  8 + <img src="/assets/images/logo.png" class="img-responsive" alt="Dialoga Brasil | O país fica melhor quando você participa" />
  9 + </a>
  10 + </div>
  11 + <div class="col-xs-2 col-xs-height col-middle">
  12 + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
  13 + <span class="sr-only">Alternar menu de navegação</span>
  14 + <span class="icon-bar" aria-hidden="true"></span>
  15 + <span class="icon-bar" aria-hidden="true"></span>
  16 + <span class="icon-bar" aria-hidden="true"></span>
  17 + </button>
  18 + </div>
  19 + </div>
  20 + </div>
  21 + </div>
  22 +
  23 + <div id="navbar-collapse" class="collapse navbar-collapse">
  24 + <ul class="nav navbar-nav navbar-right">
  25 + <li ui-sref-active="active"><a ui-sref="sobre">Sobre</a></li>
  26 + <li ui-sref-active="active"><a ui-sref="programas">Programas</a></li>
  27 + <li ui-sref-active="active"><a ui-sref="propostas">Propostas</a></li>
  28 + <li ui-sref-active="active"><a ui-sref="ranking">Ranking</a></li>
  29 + <li ui-sref-active="active"><a ui-sref="duvidas">Dúvidas</a></li>
  30 + <li role="separator" class="divider hidden-xs hidden-sm"><span>|</span></li>
  31 + <li class="dropdown" style="border: none;">
  32 + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Compartilhar <span aria-hidden="true" class="icon icon-social-share-small"></span></a>
  33 + <social-share class="dropdown-menu dropdown-menu-right" arrow-class="social-share--arrow"></social-share>
  34 + <div class="clearfix"></div>
  35 + </li>
  36 + <li class="hidden-sm hidden-md hidden-lg" style="border: none; padding-bottom: 10px !important;">
  37 + <div class="text text-right" style="padding-right: 20px;">DIALOGA <b>NAS REDES</b></div>
  38 + <ul class="social-share list-inline">
  39 + <li>
  40 + <a href="https://www.facebook.com/DialogaBrasil" target="_blank">
  41 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-facebook"><span class="icon icon-social-facebook"></span></span>
  42 + <span class="sr-only">Visitar perfil no Facebook</span>
  43 + </a>
  44 + </li>
  45 + <li>
  46 + <a href="https://twitter.com/dialogabrasil" target="_blank">
  47 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-twitter"><span class="icon icon-social-twitter"></span></span>
  48 + <span class="sr-only">Visitar perfil no Twitter</span>
  49 + </a>
  50 + </li>
  51 + <li>
  52 + <a href="https://www.youtube.com/channel/UCtjaJwOWwGu2legqFVAzhIA" target="_blank">
  53 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-youtube"><span class="icon icon-social-youtube"></span></span>
  54 + <span class="sr-only">Visitar canal no Youtube</span>
  55 + </a>
  56 + </li>
  57 + <li>
  58 + <a href="https://www.flickr.com/photos/dialogabrasil" target="_blank">
  59 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-flickr"><span class="icon icon-social-flickr"></span></span>
  60 + <span class="sr-only">Visitar canal no Flickr</span>
  61 + </a>
  62 + </li>
  63 + </ul>
  64 + <div class="clearfix"></div>
  65 + </li>
  66 + </ul>
  67 + </div>
  68 + </nav>
  69 +
  70 + <div id="dialoga-nas-redes" class="hidden-xs">
  71 + <div class="text text-right">
  72 + <p>DIALOGA<br><b>NAS REDES</b></p>
  73 + </div>
  74 + <ul class="social-share list-inline">
  75 + <li>
  76 + <a href="https://www.facebook.com/DialogaBrasil" target="_blank">
  77 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-facebook"><span class="icon icon-social-facebook"></span></span>
  78 + <span class="sr-only">Visitar perfil no Facebook</span>
  79 + </a>
  80 + </li>
  81 + <li>
  82 + <a href="https://twitter.com/dialogabrasil" target="_blank">
  83 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-twitter"><span class="icon icon-social-twitter"></span></span>
  84 + <span class="sr-only">Visitar perfil no Twitter</span>
  85 + </a>
  86 + </li>
  87 + <li>
  88 + <a href="https://www.youtube.com/channel/UCtjaJwOWwGu2legqFVAzhIA" target="_blank">
  89 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-youtube"><span class="icon icon-social-youtube"></span></span>
  90 + <span class="sr-only">Visitar canal no Youtube</span>
  91 + </a>
  92 + </li>
  93 + <li>
  94 + <a href="https://www.flickr.com/photos/dialogabrasil" target="_blank">
  95 + <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-flickr"><span class="icon icon-social-flickr"></span></span>
  96 + <span class="sr-only">Visitar canal no Flickr</span>
  97 + </a>
  98 + </li>
  99 + </ul>
  100 + </div>
  101 +</div>
src/app/components/app-navbar/app-navbar.scss 0 → 100644
@@ -0,0 +1,222 @@ @@ -0,0 +1,222 @@
  1 +.app-navbar {
  2 +
  3 + border-bottom: 2px solid #f1f1f1;
  4 +
  5 + .navbar {
  6 + margin-bottom: 0;
  7 + border: none;
  8 + }
  9 +
  10 + .navbar-brand {
  11 + height: auto;
  12 + padding-bottom: 0;
  13 + padding-left: 0;
  14 +
  15 + @media screen and (max-width: $screen-md) {
  16 + padding: 20px 0;
  17 + margin: 20px 0;
  18 + }
  19 + }
  20 +
  21 + .navbar-toggle {
  22 + border-radius: 100%;
  23 + background-color: #5e749d;
  24 +
  25 + .icon-bar {
  26 + height: 3px;
  27 + background-color: #fff;
  28 + }
  29 +
  30 + @media screen and (max-width: $screen-md) {
  31 + padding: 12px 10px;
  32 + margin: 0;
  33 + }
  34 + }
  35 +
  36 + .navbar-nav .divider span {
  37 + display: block;
  38 +
  39 + @media screen and (max-width: $screen-md) {
  40 + display: none;
  41 + }
  42 + }
  43 +
  44 + .dropdown-menu {
  45 + padding: 0;
  46 + }
  47 +
  48 + .navbar-nav {
  49 +
  50 + li > a {
  51 + text-transform: uppercase;
  52 + color: #616161;
  53 + font-weight: bold;
  54 +
  55 + &:hover,
  56 + &:focus {
  57 + background: none;
  58 + }
  59 +
  60 + .contraste & {
  61 + color: #fff;
  62 + }
  63 + }
  64 +
  65 + li.active > a {
  66 + border-bottom: 2px solid #77BB34;
  67 + }
  68 + }
  69 +
  70 + .contraste & {
  71 + .nav > li > a:hover,
  72 + .nav > li > a:focus {
  73 + color: #fff;
  74 + }
  75 +
  76 + .active a {
  77 + border-bottom-color: #fff;
  78 + }
  79 + }
  80 +
  81 + // <= Mobile
  82 + @media screen and (max-width: ($screen-sm - 1)) {
  83 + .navbar-collapse {
  84 + margin: 0 -15px;
  85 + }
  86 +
  87 + .navbar-nav {
  88 + background-color: #eee;
  89 +
  90 + & > li {
  91 + // border-top: 1px solid #ccc;
  92 + -moz-border-image: -moz-linear-gradient(left, #eee 0%, #ccc 100%);
  93 + -webkit-border-image: -webkit-linear-gradient(left, #eee 0%, #ccc 100%);
  94 + border-image: linear-gradient(to right, #eee 0%, #ccc 100%);
  95 + border-image-slice: 1;
  96 +
  97 + border-top: 1px solid #ccc;
  98 + border-bottom: 0px solid #ccc;
  99 + border-left: 0px solid #ccc;
  100 + border-right: 0px solid #ccc;
  101 + &:last-child {
  102 + border-bottom: 1px solid #ccc;
  103 + }
  104 + }
  105 +
  106 + & > li > a {
  107 + padding: 12px 20px;
  108 + margin: 0;
  109 + text-align: right;
  110 + }
  111 +
  112 + & > li.active > a {
  113 + border-bottom: none;
  114 + border-right: 4px solid #77BB34;
  115 + }
  116 +
  117 + .dropdown-toggle {
  118 + margin-top: 0px;
  119 +
  120 + }
  121 + .dropdown-menu {
  122 + position: relative;
  123 + margin-right: 10px;
  124 + }
  125 +
  126 + .social-share {
  127 + float: right;
  128 + }
  129 + }
  130 +
  131 + }
  132 +
  133 + // >= Table, < Destop
  134 + @media screen and (min-width: $screen-sm) and (max-width: ($screen-md - 1)) {
  135 + .navbar-brand {
  136 + padding-top: 0;
  137 + margin-top: 0;
  138 + margin-bottom: 60px;
  139 + }
  140 +
  141 + .navbar-collapse {
  142 + position: absolute;
  143 + left: 0;
  144 + bottom: 0;
  145 + width: 100%;
  146 +
  147 + ul.navbar-nav {
  148 + width: 100%;
  149 + float: none;
  150 + }
  151 +
  152 + li > a {
  153 + margin: 0 10px;
  154 + padding: 0 0 10px 0;
  155 + }
  156 +
  157 + li.dropdown {
  158 + position: absolute;
  159 + right: 0;
  160 + bottom: 0;
  161 +
  162 + .dropdown-toggle {
  163 + position: relative;
  164 + width: 160px;
  165 + margin: 0 5px 5px 0;
  166 + padding: 0;
  167 + }
  168 + }
  169 + }
  170 + }
  171 + // >= Desktop
  172 + @media screen and (min-width: $screen-md) {
  173 +
  174 + li > a {
  175 + padding: 15px 0;
  176 + margin: 0 9px;
  177 + }
  178 +
  179 + li.divider span{
  180 + padding: 12px 0;
  181 + line-height: 20px;
  182 + }
  183 +
  184 + li.dropdown {
  185 + .dropdown-toggle {
  186 + padding: 6px 10px;
  187 + margin: 0;
  188 + }
  189 + }
  190 + }
  191 +
  192 + // > Desktop Large
  193 + @media screen and (min-width: $screen-lg) {
  194 + .navbar-brand {
  195 + margin-bottom: 30px;
  196 + }
  197 +
  198 + ul.navbar-nav {
  199 + position: absolute;
  200 + right: 0;
  201 + bottom: 0;
  202 + }
  203 +
  204 + li.divider span{
  205 + padding: 12px 6px;
  206 + }
  207 + }
  208 +}
  209 +
  210 +#dialoga-nas-redes {
  211 + position: absolute;
  212 + right: 0;
  213 + top: 0;
  214 + z-index: 1000;
  215 +
  216 + .text {
  217 + position: absolute;
  218 + top: 5px;
  219 + right: 210px;
  220 + width: 100px;
  221 + }
  222 +}
src/app/components/article-service/article.service.js
@@ -250,11 +250,25 @@ @@ -250,11 +250,25 @@
250 250
251 function searchProposals (params, cbSuccess, cbError) { 251 function searchProposals (params, cbSuccess, cbError) {
252 // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas 252 // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas
253 - var url = service.apiSearch + '/article'; 253 + var url = service.apiSearch + 'article';
254 var paramsExtended = angular.extend({ 254 var paramsExtended = angular.extend({
255 page: 1, 255 page: 1,
256 - per_page: 20,  
257 - type: 'ProposalsDiscussionPlugin::Proposal' 256 + per_page: 10,
  257 + type: 'ProposalsDiscussionPlugin::Proposal',
  258 + 'fields[]': [
  259 + 'id',
  260 + 'abstract',
  261 + 'hits',
  262 + 'ranking_position',
  263 + 'votes_against',
  264 + 'votes_count',
  265 + 'votes_for',
  266 + 'parent',
  267 + 'categories',
  268 + 'slug',
  269 + 'url', // parent.image.url
  270 + 'image',
  271 + ]
258 }, params); 272 }, params);
259 273
260 UtilService.get(url, {params: paramsExtended}).then(function(data){ 274 UtilService.get(url, {params: paramsExtended}).then(function(data){
src/app/components/auth/auth.service.js
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 $rootScope.$broadcast(AUTH_EVENTS.loginSuccess, currentUser); 52 $rootScope.$broadcast(AUTH_EVENTS.loginSuccess, currentUser);
53 } 53 }
54 54
55 - $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, currentUser); 55 + $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, data.user);
56 return response; 56 return response;
57 }, function(response) { 57 }, function(response) {
58 $log.debug('AuthService.register [FAIL] response', response); 58 $log.debug('AuthService.register [FAIL] response', response);
src/app/components/navbar/navbar.directive.js
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -(function() {  
2 - 'use strict';  
3 -  
4 - angular  
5 - .module('dialoga')  
6 - .directive('appNavbar', appNavbar);  
7 -  
8 - /** @ngInject */  
9 - function appNavbar() {  
10 -  
11 - /** @ngInject */  
12 - function NavbarController($log) {  
13 - $log.debug('NavbarController');  
14 -  
15 - var vm = this;  
16 -  
17 - vm.scrollTo = function(hash) {  
18 - var $el = angular.element('#' + hash);  
19 - angular.element('body').animate({scrollTop: $el.offset().top}, 'slow');  
20 - };  
21 - }  
22 -  
23 - var directive = {  
24 - restrict: 'E',  
25 - templateUrl: 'app/components/navbar/navbar.html',  
26 - scope: {  
27 - creationDate: '='  
28 - },  
29 - controller: NavbarController,  
30 - controllerAs: 'vm',  
31 - bindToController: true  
32 - };  
33 -  
34 - return directive;  
35 - }  
36 -  
37 -})();  
src/app/components/navbar/navbar.html
@@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
1 -<div class="app-navbar">  
2 - <nav id="navigation" class="header-navbar navbar" role="navigation">  
3 - <div class="navbar-header">  
4 - <div class="row">  
5 - <div class="row-height">  
6 - <div class="col-xs-10 col-xs-height col-middle">  
7 - <a class="navbar-brand" ui-sref="inicio">  
8 - <img src="/assets/images/logo.png" class="img-responsive" alt="Dialoga Brasil | O país fica melhor quando você participa" />  
9 - </a>  
10 - </div>  
11 - <div class="col-xs-2 col-xs-height col-middle">  
12 - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">  
13 - <span class="sr-only">Alternar menu de navegação</span>  
14 - <span class="icon-bar" aria-hidden="true"></span>  
15 - <span class="icon-bar" aria-hidden="true"></span>  
16 - <span class="icon-bar" aria-hidden="true"></span>  
17 - </button>  
18 - </div>  
19 - </div>  
20 - </div>  
21 - </div>  
22 -  
23 - <div id="navbar-collapse" class="collapse navbar-collapse">  
24 - <ul class="nav navbar-nav navbar-right">  
25 - <li ui-sref-active="active"><a ui-sref="sobre">Sobre</a></li>  
26 - <li ui-sref-active="active"><a ui-sref="programas">Programas</a></li>  
27 - <li ui-sref-active="active"><a ui-sref="propostas">Propostas</a></li>  
28 - <li ui-sref-active="active"><a ui-sref="ranking">Ranking</a></li>  
29 - <li ui-sref-active="active"><a ui-sref="duvidas">Dúvidas</a></li>  
30 - <li role="separator" class="divider hidden-xs hidden-sm"><span>|</span></li>  
31 - <li class="dropdown">  
32 - <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Compartilhar <span aria-hidden="true" class="icon icon-social-share-small"></span></a>  
33 - <social-share class="dropdown-menu dropdown-menu-right" arrow-class="social-share--arrow"></social-share>  
34 - </li>  
35 - </ul>  
36 - </div>  
37 - </nav>  
38 -  
39 - <div id="dialoga-nas-redes" class="hidden-xs">  
40 - <div class="text text-right">  
41 - <p>DIALOGA<br><b>NAS REDES</b></p>  
42 - </div>  
43 - <ul class="social-share list-inline">  
44 - <li>  
45 - <a href="https://www.facebook.com/DialogaBrasil" target="_blank">  
46 - <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-facebook"><span class="icon icon-social-facebook"></span></span>  
47 - <span class="sr-only">Visitar perfil no Facebook</span>  
48 - </a>  
49 - </li>  
50 - <li>  
51 - <a href="https://twitter.com/dialogabrasil" target="_blank">  
52 - <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-twitter"><span class="icon icon-social-twitter"></span></span>  
53 - <span class="sr-only">Visitar perfil no Twitter</span>  
54 - </a>  
55 - </li>  
56 - <li>  
57 - <a href="https://www.youtube.com/channel/UCtjaJwOWwGu2legqFVAzhIA" target="_blank">  
58 - <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-youtube"><span class="icon icon-social-youtube"></span></span>  
59 - <span class="sr-only">Visitar canal no Youtube</span>  
60 - </a>  
61 - </li>  
62 - <li>  
63 - <a href="https://www.flickr.com/photos/dialogabrasil" target="_blank">  
64 - <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-flickr"><span class="icon icon-social-flickr"></span></span>  
65 - <span class="sr-only">Visitar canal no Flickr</span>  
66 - </a>  
67 - </li>  
68 - </ul>  
69 - </div>  
70 -</div>  
src/app/components/navbar/navbar.scss
@@ -1,222 +0,0 @@ @@ -1,222 +0,0 @@
1 -.app-navbar {  
2 -  
3 - border-bottom: 2px solid #f1f1f1;  
4 -  
5 - .navbar {  
6 - margin-bottom: 0;  
7 - border: none;  
8 - }  
9 -  
10 - .navbar-brand {  
11 - height: auto;  
12 - padding-bottom: 0;  
13 - padding-left: 0;  
14 -  
15 - @media screen and (max-width: $screen-md) {  
16 - padding: 20px 0;  
17 - margin: 20px 0;  
18 - }  
19 - }  
20 -  
21 - .navbar-toggle {  
22 - border-radius: 100%;  
23 - background-color: #5e749d;  
24 -  
25 - .icon-bar {  
26 - height: 3px;  
27 - background-color: #fff;  
28 - }  
29 -  
30 - @media screen and (max-width: $screen-md) {  
31 - padding: 12px 10px;  
32 - margin: 0;  
33 - }  
34 - }  
35 -  
36 - .navbar-nav .divider span {  
37 - display: block;  
38 -  
39 - @media screen and (max-width: $screen-md) {  
40 - display: none;  
41 - }  
42 - }  
43 -  
44 - .dropdown-menu {  
45 - padding: 0;  
46 - }  
47 -  
48 - .navbar-nav {  
49 -  
50 - li > a {  
51 - text-transform: uppercase;  
52 - color: #616161;  
53 - font-weight: bold;  
54 -  
55 - &:hover,  
56 - &:focus {  
57 - background: none;  
58 - }  
59 -  
60 - .contraste & {  
61 - color: #fff;  
62 - }  
63 - }  
64 -  
65 - li.active > a {  
66 - border-bottom: 2px solid #77BB34;  
67 - }  
68 - }  
69 -  
70 - .contraste & {  
71 - .nav > li > a:hover,  
72 - .nav > li > a:focus {  
73 - color: #fff;  
74 - }  
75 -  
76 - .active a {  
77 - border-bottom-color: #fff;  
78 - }  
79 - }  
80 -  
81 - // <= Mobile  
82 - @media screen and (max-width: ($screen-sm - 1)) {  
83 - .navbar-collapse {  
84 - margin: 0 -15px;  
85 - }  
86 -  
87 - .navbar-nav {  
88 - background-color: #eee;  
89 -  
90 - & > li {  
91 - // border-top: 1px solid #ccc;  
92 - -moz-border-image: -moz-linear-gradient(left, #eee 0%, #ccc 100%);  
93 - -webkit-border-image: -webkit-linear-gradient(left, #eee 0%, #ccc 100%);  
94 - border-image: linear-gradient(to right, #eee 0%, #ccc 100%);  
95 - border-image-slice: 1;  
96 -  
97 - border-top: 1px solid #ccc;  
98 - border-bottom: 0px solid #ccc;  
99 - border-left: 0px solid #ccc;  
100 - border-right: 0px solid #ccc;  
101 - &:last-child {  
102 - border-bottom: 1px solid #ccc;  
103 - }  
104 - }  
105 -  
106 - & > li > a {  
107 - padding: 12px 20px;  
108 - margin: 0;  
109 - text-align: right;  
110 - }  
111 -  
112 - & > li.active > a {  
113 - border-bottom: none;  
114 - border-right: 4px solid #77BB34;  
115 - }  
116 -  
117 - .dropdown-toggle {  
118 - margin-top: 0px;  
119 -  
120 - }  
121 - .dropdown-menu {  
122 - position: relative;  
123 - margin-right: 10px;  
124 - }  
125 -  
126 - .social-share {  
127 - float: right;  
128 - }  
129 - }  
130 -  
131 - }  
132 -  
133 - // >= Table, < Destop  
134 - @media screen and (min-width: $screen-sm) and (max-width: ($screen-md - 1)) {  
135 - .navbar-brand {  
136 - padding-top: 0;  
137 - margin-top: 0;  
138 - margin-bottom: 60px;  
139 - }  
140 -  
141 - .navbar-collapse {  
142 - position: absolute;  
143 - left: 0;  
144 - bottom: 0;  
145 - width: 100%;  
146 -  
147 - ul.navbar-nav {  
148 - width: 100%;  
149 - float: none;  
150 - }  
151 -  
152 - li > a {  
153 - margin: 0 10px;  
154 - padding: 0 0 10px 0;  
155 - }  
156 -  
157 - li.dropdown {  
158 - position: absolute;  
159 - right: 0;  
160 - bottom: 0;  
161 -  
162 - .dropdown-toggle {  
163 - position: relative;  
164 - width: 160px;  
165 - margin: 0 5px 5px 0;  
166 - padding: 0;  
167 - }  
168 - }  
169 - }  
170 - }  
171 - // >= Desktop  
172 - @media screen and (min-width: $screen-md) {  
173 -  
174 - li > a {  
175 - padding: 15px 0;  
176 - margin: 0 9px;  
177 - }  
178 -  
179 - li.divider span{  
180 - padding: 12px 0;  
181 - line-height: 20px;  
182 - }  
183 -  
184 - li.dropdown {  
185 - .dropdown-toggle {  
186 - padding: 6px 10px;  
187 - margin: 0;  
188 - }  
189 - }  
190 - }  
191 -  
192 - // > Desktop Large  
193 - @media screen and (min-width: $screen-lg) {  
194 - .navbar-brand {  
195 - margin-bottom: 30px;  
196 - }  
197 -  
198 - ul.navbar-nav {  
199 - position: absolute;  
200 - right: 0;  
201 - bottom: 0;  
202 - }  
203 -  
204 - li.divider span{  
205 - padding: 12px 6px;  
206 - }  
207 - }  
208 -}  
209 -  
210 -#dialoga-nas-redes {  
211 - position: absolute;  
212 - right: 0;  
213 - top: 0;  
214 - z-index: 1000;  
215 -  
216 - .text {  
217 - position: absolute;  
218 - top: 5px;  
219 - right: 210px;  
220 - width: 100px;  
221 - }  
222 -}  
src/app/index.run.js
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 .run(runAccessibility) 7 .run(runAccessibility)
8 .run(runAuth) 8 .run(runAuth)
9 .run(runCaptcha) 9 .run(runCaptcha)
10 - .run(runColorUtils) 10 + // .run(runColorUtils)
11 .run(runHistory) 11 .run(runHistory)
12 .run(runPath) 12 .run(runPath)
13 .run(runSocialAuth) 13 .run(runSocialAuth)
@@ -16,6 +16,118 @@ @@ -16,6 +16,118 @@
16 .run(runBlock); 16 .run(runBlock);
17 17
18 /** @ngInject */ 18 /** @ngInject */
  19 + function runAccessibility($rootScope, $timeout, $interval, $cookies, $state, $log) {
  20 +
  21 + var contrast = $cookies.get('dialoga_contraste') === 'true';
  22 + adjustContrast(contrast);
  23 +
  24 + function adjustContrast(state) {
  25 + var bodyEl = angular.element(document).find('body');
  26 + angular.element(bodyEl).toggleClass('contraste', !!state);
  27 + }
  28 +
  29 + $rootScope.actionContrast = function() {
  30 + // toggle contrast
  31 + contrast = !contrast;
  32 + $cookies.put('dialoga_contraste', contrast);
  33 + adjustContrast(contrast);
  34 + };
  35 +
  36 + $rootScope.focusOn = function(elId, $event) {
  37 + var el = angular.element(elId);
  38 + $rootScope.scrollTo(el, $event);
  39 + el.attr('tabIndex', -1).focus();
  40 + };
  41 +
  42 + $rootScope.focusMainContent = function($event) {
  43 +
  44 + var mainContentArea = document.querySelector('[role="main"]');
  45 +
  46 + if (mainContentArea) {
  47 + $timeout(function() {
  48 + $rootScope.scrollTo(angular.element(mainContentArea), $event);
  49 + }, 90); // force queue
  50 + } else {
  51 + $log.info('role="main" not found.');
  52 + }
  53 + };
  54 +
  55 + $rootScope.focusOnSearch = function($event) {
  56 +
  57 + // prevent skip link from redirecting
  58 + if ($event) { $event.preventDefault(); }
  59 +
  60 + // find a input search
  61 + var $searchEl = angular.element('input[type="search"]:visible');
  62 +
  63 + if($searchEl && $searchEl.length > 0){
  64 + // scroll
  65 + angular.element('html,body').animate({scrollTop: $searchEl.offset().top}, 'fast');
  66 + // focus
  67 + $searchEl.focus();
  68 + } else {
  69 + // input search not found
  70 +
  71 + // 1. redirect to home
  72 + var promise = $state.go('inicio', { reload: true});
  73 +
  74 + // 2. focus on input search at home.
  75 + promise.then(function(){
  76 +
  77 + findElAsync('input[type="search"]:visible', function ($el) {
  78 + // scroll
  79 + angular.element('html,body').animate({scrollTop: $el.offset().top}, 'fast');
  80 + // focus
  81 + $el.focus();
  82 + });
  83 + });
  84 + }
  85 +
  86 + // use jQuery and $interval to find element async.
  87 + function findElAsync(query, cb, delay, max_exec) {
  88 + delay = delay || 200;
  89 + max_exec = max_exec || 20;
  90 + var count_exec = 0;
  91 +
  92 + var stop = null;
  93 + stop = $interval(function() {
  94 + var $el = angular.element(query);
  95 +
  96 + if ($el && $el.length > 0) {
  97 + cb($el);
  98 + }else {
  99 + $log.debug('[findElAsync] element not found.');
  100 + }
  101 +
  102 + count_exec++;
  103 +
  104 + if (count_exec >= max_exec){
  105 + $interval.cancel(stop);
  106 + stop = undefined;
  107 + }
  108 +
  109 + }, delay);
  110 + }
  111 +
  112 + $log.debug('TODO: focusOnSearch');
  113 + };
  114 +
  115 + $rootScope.scrollTo = function(target, $event) {
  116 +
  117 + // prevent skip link from redirecting
  118 + if ($event) { $event.preventDefault(); }
  119 +
  120 + if (angular.isString(target)) {
  121 + target = angular.element(target);
  122 + }
  123 +
  124 + angular.element('html,body').animate({scrollTop: target.offset().top}, 'fast');
  125 + };
  126 +
  127 + $log.debug('[RUN] Accessibility end.');
  128 + }
  129 +
  130 + /** @ngInject */
19 function runAuth($rootScope, $localStorage, USER_ROLES, AUTH_EVENTS, AuthService, $log) { 131 function runAuth($rootScope, $localStorage, USER_ROLES, AUTH_EVENTS, AuthService, $log) {
20 132
21 // Listner url/state changes, and check permission 133 // Listner url/state changes, and check permission
@@ -82,89 +194,32 @@ @@ -82,89 +194,32 @@
82 $log.debug('runCaptcha'); 194 $log.debug('runCaptcha');
83 } 195 }
84 196
85 - /** @ngInject */  
86 - function runSocialAuth($window, $rootScope, $interval) { 197 + // /** @ngInject */
  198 + // function runColorUtils($window) {
87 199
88 - $window.oauthClientAction = function(url) {  
89 - var child = $window.open(url, '_blank');  
90 - var interval = $interval(function() {  
91 - try {  
92 - if (!child.closed) {  
93 - child.postMessage({  
94 - message: 'requestOauthClientPluginResult'  
95 - }, '*');  
96 - }  
97 - } catch (e) {  
98 - // we're here when the child window has been navigated away or closed  
99 - if (child.closed) {  
100 - $interval.cancel(interval);  
101 - interval = undefined;  
102 - }  
103 - }  
104 - }, 300);  
105 - }; 200 + // $window.ColorLuminance = function(hex, lum) {
106 201
107 - $window.addEventListener('message', function(eventMessage) {  
108 - // $log.debug('eventMessage', eventMessage); 202 + // // validate hex string
  203 + // hex = String(hex).replace(/[^0-9a-f]/gi, '');
  204 + // if (hex.length < 6) {
  205 + // hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
  206 + // }
  207 + // lum = lum || 0;
109 208
110 - if (eventMessage.data.message === 'oauthClientPluginResult') {  
111 - $rootScope.$broadcast('oauthClientPluginResult', eventMessage);  
112 - // eventMessage.source.close();  
113 - }  
114 - });  
115 - } 209 + // // convert to decimal and change luminosity
  210 + // var rgb = '#';
  211 + // var c;
  212 + // var i;
116 213
117 - /** @ngInject */  
118 - function runAccessibility($rootScope, $timeout, $cookies, $log) {  
119 -  
120 - var contrast = $cookies.get('dialoga_contraste') === 'true';  
121 - adjustContrast(contrast); 214 + // for (i = 0; i < 3; i++) {
  215 + // c = parseInt(hex.substr(i * 2, 2), 16);
  216 + // c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
  217 + // rgb += ('00' + c).substr(c.length);
  218 + // }
122 219
123 - function adjustContrast(state) {  
124 - var bodyEl = angular.element(document).find('body');  
125 - angular.element(bodyEl).toggleClass('contraste', !!state);  
126 - }  
127 -  
128 - $rootScope.actionContrast = function() {  
129 - // toggle contrast  
130 - contrast = !contrast;  
131 - $cookies.put('dialoga_contraste', contrast);  
132 - adjustContrast(contrast);  
133 - };  
134 -  
135 - $rootScope.focusOn = function(elId, $event) {  
136 - var el = angular.element(elId);  
137 - $rootScope.scrollTo(el, $event);  
138 - el.attr('tabIndex', -1).focus();  
139 - };  
140 -  
141 - $rootScope.focusMainContent = function($event) {  
142 -  
143 - var mainContentArea = document.querySelector('[role="main"]');  
144 -  
145 - if (mainContentArea) {  
146 - $timeout(function() {  
147 - $rootScope.scrollTo(angular.element(mainContentArea), $event);  
148 - }, 90); // force queue  
149 - } else {  
150 - $log.info('role="main" not found.');  
151 - }  
152 - };  
153 -  
154 - $rootScope.scrollTo = function(target, $event) {  
155 -  
156 - // prevent skip link from redirecting  
157 - if ($event) { $event.preventDefault(); }  
158 -  
159 - if (angular.isString(target)) {  
160 - target = angular.element(target);  
161 - }  
162 -  
163 - angular.element('body').animate({scrollTop: target.offset().top}, 'fast');  
164 - };  
165 -  
166 - $log.debug('[RUN] Accessibility end.');  
167 - } 220 + // return rgb;
  221 + // };
  222 + // }
168 223
169 /** @ngInject */ 224 /** @ngInject */
170 function runHistory($rootScope) { 225 function runHistory($rootScope) {
@@ -188,30 +243,35 @@ @@ -188,30 +243,35 @@
188 } 243 }
189 244
190 /** @ngInject */ 245 /** @ngInject */
191 - function runColorUtils($window) {  
192 -  
193 - $window.ColorLuminance = function(hex, lum) { 246 + function runSocialAuth($window, $rootScope, $interval) {
194 247
195 - // validate hex string  
196 - hex = String(hex).replace(/[^0-9a-f]/gi, '');  
197 - if (hex.length < 6) {  
198 - hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];  
199 - }  
200 - lum = lum || 0; 248 + $window.oauthClientAction = function(url) {
  249 + var child = $window.open(url, '_blank');
  250 + var interval = $interval(function() {
  251 + try {
  252 + if (!child.closed) {
  253 + child.postMessage({
  254 + message: 'requestOauthClientPluginResult'
  255 + }, '*');
  256 + }
  257 + } catch (e) {
  258 + // we're here when the child window has been navigated away or closed
  259 + if (child.closed) {
  260 + $interval.cancel(interval);
  261 + interval = undefined;
  262 + }
  263 + }
  264 + }, 300);
  265 + };
201 266
202 - // convert to decimal and change luminosity  
203 - var rgb = '#';  
204 - var c;  
205 - var i; 267 + $window.addEventListener('message', function(eventMessage) {
  268 + // $log.debug('eventMessage', eventMessage);
206 269
207 - for (i = 0; i < 3; i++) {  
208 - c = parseInt(hex.substr(i * 2, 2), 16);  
209 - c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);  
210 - rgb += ('00' + c).substr(c.length); 270 + if (eventMessage.data.message === 'oauthClientPluginResult') {
  271 + $rootScope.$broadcast('oauthClientPluginResult', eventMessage);
  272 + // eventMessage.source.close();
211 } 273 }
212 -  
213 - return rgb;  
214 - }; 274 + });
215 } 275 }
216 276
217 /** @ngInject */ 277 /** @ngInject */
@@ -221,7 +281,7 @@ @@ -221,7 +281,7 @@
221 281
222 if($resultEl && $resultEl.length > 0){ 282 if($resultEl && $resultEl.length > 0){
223 $rootScope.scrollTo($resultEl); 283 $rootScope.scrollTo($resultEl);
224 - // angular.element('body').animate({scrollTop: $resultEl.offset().top}, 'fast'); 284 + // angular.element('html,body').animate({scrollTop: $resultEl.offset().top}, 'fast');
225 } 285 }
226 }); 286 });
227 } 287 }
src/app/pages/auth/auth.controller.js
@@ -155,11 +155,11 @@ @@ -155,11 +155,11 @@
155 case 400: // bad request 155 case 400: // bad request
156 var errors = JSON.parse(response.data.message); 156 var errors = JSON.parse(response.data.message);
157 if(errors && errors.email){ 157 if(errors && errors.email){
158 - vm.signupErrorMessage = "E-mail já está em uso." 158 + vm.signupErrorMessage = 'E-mail já está em uso.';
159 } 159 }
160 break; 160 break;
161 case 500: 161 case 500:
162 - vm.signupErrorMessage = message; 162 + vm.signupErrorMessage = response.data.message;
163 break; 163 break;
164 default: 164 default:
165 break; 165 break;
src/app/pages/propostas/propostas.controller.js
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 var vm = this; 28 var vm = this;
29 29
30 vm.page = 1; 30 vm.page = 1;
31 - vm.per_page = 20; 31 + vm.per_page = 10;
32 vm.themes = null; 32 vm.themes = null;
33 vm.selectedTheme = null; 33 vm.selectedTheme = null;
34 vm.filtredPrograms = null; 34 vm.filtredPrograms = null;
@@ -57,9 +57,11 @@ @@ -57,9 +57,11 @@
57 vm.loadingThemes = false; 57 vm.loadingThemes = false;
58 vm.loading = false; 58 vm.loading = false;
59 59
60 - vm.loadProposals(function() {  
61 - vm.attachListeners();  
62 - }); 60 + // REMOVED: function called twice.
  61 + // vm.loadProposals(function() {
  62 + // vm.attachListeners();
  63 + // });
  64 + vm.attachListeners();
63 }, function(error) { 65 }, function(error) {
64 vm.error = error; 66 vm.error = error;
65 vm.$log.error(error); 67 vm.$log.error(error);
@@ -68,29 +70,29 @@ @@ -68,29 +70,29 @@
68 }); 70 });
69 }; 71 };
70 72
71 - PropostasPageController.prototype.loadProposals = function(cb) {  
72 - var vm = this;  
73 -  
74 - // load Proposals  
75 - vm.loadingProposals = true;  
76 - vm.DialogaService.searchProposals({  
77 - page: vm.page,  
78 - per_page: vm.per_page  
79 - }, function(data) {  
80 - vm.filtredProposals = data.articles;  
81 - vm.total_proposals = parseInt(data._obj.headers('total'));  
82 -  
83 - vm.loadingProposals = false;  
84 -  
85 - if (cb) {  
86 - cb();  
87 - }  
88 - }, function(error) {  
89 - vm.error = error;  
90 - vm.$log.error(error);  
91 - vm.loadingProposals = false;  
92 - });  
93 - }; 73 + // PropostasPageController.prototype.loadProposals = function(cb) {
  74 + // var vm = this;
  75 +
  76 + // // load Proposals
  77 + // vm.loadingProposals = true;
  78 + // vm.DialogaService.searchProposals({
  79 + // page: vm.page,
  80 + // per_page: vm.per_page
  81 + // }, function(data) {
  82 + // vm.filtredProposals = data.articles;
  83 + // vm.total_proposals = parseInt(data._obj.headers('total'));
  84 +
  85 + // vm.loadingProposals = false;
  86 +
  87 + // if (cb) {
  88 + // cb();
  89 + // }
  90 + // }, function(error) {
  91 + // vm.error = error;
  92 + // vm.$log.error(error);
  93 + // vm.loadingProposals = false;
  94 + // });
  95 + // };
94 96
95 PropostasPageController.prototype.attachListeners = function() { 97 PropostasPageController.prototype.attachListeners = function() {
96 var vm = this; 98 var vm = this;
src/app/pages/ranking/ranking.controller.js
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 18
19 vm.init(); 19 vm.init();
20 vm.loadData(); 20 vm.loadData();
21 - // vm.attachListeners(); // attach listeners after load data (SYNC) 21 + vm.attachListeners(); // attach listeners after load data (SYNC)
22 vm.$rootScope.focusMainContent(); 22 vm.$rootScope.focusMainContent();
23 23
24 $log.debug('RankingPageController'); 24 $log.debug('RankingPageController');
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 // (AND 4) 83 // (AND 4)
84 var themeId = vm.selectedTheme.id; 84 var themeId = vm.selectedTheme.id;
85 vm.loadPrograms(themeId, function(){ 85 vm.loadPrograms(themeId, function(){
86 - vm.loadProposals(); 86 + // vm.loadProposals();
87 vm.loading = false; 87 vm.loading = false;
88 }); 88 });
89 }, function (error) { 89 }, function (error) {
@@ -131,25 +131,25 @@ @@ -131,25 +131,25 @@
131 }); 131 });
132 }; 132 };
133 133
134 - RankingPageController.prototype.loadProposals = function () {  
135 - var vm = this;  
136 -  
137 - // load Proposals  
138 - vm.loadingProposals = true;  
139 - vm.DialogaService.getProposals({  
140 - page: vm.page,  
141 - per_page: vm.per_page  
142 - }, function(data){  
143 - vm.filtredProposals = data.articles;  
144 - vm.loadingProposals = false;  
145 -  
146 - vm.attachListeners();  
147 - }, function (error) {  
148 - vm.error = error;  
149 - vm.$log.error(error);  
150 - vm.loadingProposals = false;  
151 - });  
152 - }; 134 + // RankingPageController.prototype.loadProposals = function () {
  135 + // var vm = this;
  136 +
  137 + // // load Proposals
  138 + // vm.loadingProposals = true;
  139 + // vm.DialogaService.getProposals({
  140 + // page: vm.page,
  141 + // per_page: vm.per_page
  142 + // }, function(data){
  143 + // vm.filtredProposals = data.articles;
  144 + // vm.loadingProposals = false;
  145 +
  146 + // vm.attachListeners();
  147 + // }, function (error) {
  148 + // vm.error = error;
  149 + // vm.$log.error(error);
  150 + // vm.loadingProposals = false;
  151 + // });
  152 + // };
153 153
154 RankingPageController.prototype.attachListeners = function() { 154 RankingPageController.prototype.attachListeners = function() {
155 var vm = this; 155 var vm = this;