Commit 6362a2133976d643a93d4d8eeeb68a120eb8e22f

Authored by Eder Carlos
2 parents 19d09fe7 cfe61fa8

Merge branch 'master' of https://gitlab.com/participa/proposal-app

Showing 3 changed files with 267 additions and 92 deletions   Show diff stats
index.html
... ... @@ -109,7 +109,10 @@
109 109 </div>
110 110 </header>
111 111  
112   - <div id="article-container" class="hide"></div>
  112 + <div id="article-container" class="article-container hide">
  113 + <a href="#" class="go-back">Voltar</a>
  114 + <div class="article-content"></div>
  115 + </div>
113 116  
114 117 <div id="content" class="container">
115 118 <div class="embed-responsive embed-responsive-16by9">
... ... @@ -286,7 +289,7 @@
286 289 </section>
287 290 </div>
288 291  
289   - <div class="results-container hide box box-propostas col-sm-12"></div>
  292 + <div class="results-container hide col-sm-12"></div>
290 293  
291 294 <div class="talk-proposal-container col-sm-12">
292 295 <section class="talk-proposal box box-propostas">
... ... @@ -350,40 +353,42 @@
350 353 </script>
351 354  
352 355 <script id="results" type="text/x-handlebars-template">
353   - <div class="loading">Carregando...</div>
354   - <div class="results-content hide">
355   - <a href="#" class="vote-result"><span class="sr-only">Fechar</span><span class="fa fa-times"></span></a>
356   - <h2>Resultados</h2>
357   - <span class="total">Total de propostas: <strong class="value">{{pagination.total}}</strong></span>
358   - <div class="updated-at">
359   - <span>Última atualização </span>
360   - <span class="timeago" title="{{updated_at}}"></span>
361   - </div>
362   - <div class="border">
363   - <table class="footable">
364   - <thead>
365   - <tr class="header">
366   - <th class="position">Posição <a href="#" class="hidden-xs"><span class="fa fa-question"></span></a></th>
367   - <th class="abstract-text" data-toggle="true">Propostas</th>
368   - <th class="views" data-hide="phone">Exibições</th>
369   - <th class="votes-for" data-hide="phone"><span class="sr-only">A favor</span><span class="fa fa-check"></span></th>
370   - <th class="votes-against" data-hide="phone"><span class="sr-only">Contra</span><span class="fa fa-times"></span></th>
371   - </tr>
372   - </thead>
373   - <tbody>
374   - {{#each proposals}}
375   - <tr>
376   - <td class="">{{calcPosition @index ../pagination.per_page ../pagination.page}}°</td>
377   - <td class="abstract-text"><div class="truncate"><p class="truncated">{{stripTags abstract}}</p></div></td>
378   - <td class="views value">{{hits}}</td>
379   - <td class="votes-for value">{{votes_for}}</td>
380   - <td class="votes-against value">{{votes_against}}</td>
381   - </tr>
382   - {{/each}}
383   - </tbody>
384   - </table>
  356 + <div class="box box-propostas">
  357 + <div class="loading">Carregando...</div>
  358 + <div class="results-content hide">
  359 + <a href="#" class="vote-result"><span class="sr-only">Fechar</span><span class="fa fa-times"></span></a>
  360 + <h2>Resultados</h2>
  361 + <span class="total">Total de propostas: <strong class="value">{{pagination.total}}</strong></span>
  362 + <div class="updated-at">
  363 + <span>Última atualização </span>
  364 + <span class="timeago" title="{{updated_at}}"></span>
  365 + </div>
  366 + <div class="border">
  367 + <table class="footable">
  368 + <thead>
  369 + <tr class="header">
  370 + <th class="position">Posição <a href="#" class="hidden-xs"><span class="fa fa-question"></span></a></th>
  371 + <th class="abstract-text" data-toggle="true">Propostas</th>
  372 + <th class="views" data-hide="phone">Exibições</th>
  373 + <th class="votes-for" data-hide="phone"><span class="sr-only">A favor</span><span class="fa fa-check"></span></th>
  374 + <th class="votes-against" data-hide="phone"><span class="sr-only">Contra</span><span class="fa fa-times"></span></th>
  375 + </tr>
  376 + </thead>
  377 + <tbody>
  378 + {{#each proposals}}
  379 + <tr>
  380 + <td class="">{{calcPosition @index ../pagination.per_page ../pagination.page}}°</td>
  381 + <td class="abstract-text"><div class="truncate"><p class="truncated">{{stripTags abstract}}</p></div></td>
  382 + <td class="views value">{{hits}}</td>
  383 + <td class="votes-for value">{{votes_for}}</td>
  384 + <td class="votes-against value">{{votes_against}}</td>
  385 + </tr>
  386 + {{/each}}
  387 + </tbody>
  388 + </table>
  389 + </div>
  390 + <div class="paging"></div>
385 391 </div>
386   - <div class="paging"></div>
387 392 </div>
388 393 </script>
389 394  
... ... @@ -412,8 +417,8 @@
412 417 </div>
413 418 <div class="oauth col-sm-8">
414 419 <span class="label">Ou acesse usando <i>&raquo;</i></span>
415   - <a href="http://login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id=5" target="_blank" class="facebook oauth-login icon icon-facebook">Facebook</a>
416   - <a href="http://login.dialoga.gov.br/plugin/oauth_client/google_oauth2?oauth_client_popup=true&id=2" target="_blank" class="google oauth-login icon icon-gplus">Google +</a>
  420 + <a href="http://login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id=5" target="_blank" class="facebook oauth-login icon icon-facebook"><span class="fa fa-facebook"></span><span class="sr-only">Facebook</span></a>
  421 + <a href="http://login.dialoga.gov.br/plugin/oauth_client/google_oauth2?oauth_client_popup=true&id=2" target="_blank" class="google oauth-login icon icon-gplus"><span class="fa fa-google-plus"></span><span class="sr-only">Google Plus</span></a>
417 422 </div>
418 423 </div>
419 424 </form>
... ... @@ -479,7 +484,7 @@
479 484 </div>
480 485 </script>
481 486  
482   - <div class="terms-of-use">
  487 + <div class="terms-of-use text-center">
483 488 <a href="#/artigo/107880">Termos de uso</a>
484 489 </div>
485 490  
... ...
js/main.js
... ... @@ -18,13 +18,15 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
18 18  
19 19 var loginButton;
20 20  
  21 + var lastHash;
  22 +
21 23 var participa = true;
22 24  
23 25 //Detects for localhost settings
24 26 var patt = new RegExp(":3000/");
25 27 if(patt.test(window.location.href))
26 28 participa = false;
27   -
  29 +
28 30 if(participa){
29 31 var host = 'http://www.participa.br';
30 32 var proposal_discussion = '103358'; //participa
... ... @@ -226,15 +228,16 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
226 228 }
227 229 return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
228 230 },
229   - display_article: function(article_id) {
  231 + display_article: function(article_id, backTo) {
230 232 var url = host + '/api/v1/articles/' + article_id + '?private_token=' + Main.private_token;
231 233 $.getJSON(url).done(function( data ) {
232   - $('#article-container').html(articleTemplate(data.article));
  234 + $('#article-container .article-content').html(articleTemplate(data.article));
233 235 $('#article-container').show();
234 236 $('#proposal-categories').hide();
235 237 $('#proposal-group').hide();
236 238 $('nav').hide();
237 239 $('#content').hide();
  240 + $('#article-container .go-back').attr('href', backTo);
238 241 });
239 242 },
240 243 // inicio Eduardo
... ... @@ -431,9 +434,10 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
431 434 },
432 435 locationHashChanged: function(){
433 436 var hash = window.location.hash;
434   - this.navigateTo(hash);
  437 + this.navigateTo(hash, lastHash);
  438 + lastHash = hash;
435 439 },
436   - navigateTo: function(hash){
  440 + navigateTo: function(hash, lastHash) {
437 441 var scrollTop = 0;
438 442 var $nav = $('nav[role="tabpanel"]');
439 443 var navOffset = $nav.offset();
... ... @@ -459,7 +463,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
459 463 var isArticle = regexArticle.exec(hash) !== null;
460 464  
461 465 if(isArticle) {
462   - this.display_article(hash.split('/')[2]);
  466 + this.display_article(hash.split('/')[2], lastHash);
463 467 }
464 468  
465 469 if( isProposal ){
... ... @@ -543,12 +547,21 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
543 547 }
544 548 }, 300);
545 549 },
546   - responseToText: function(responseJSONmessage){
547   - var o = JSON.parse(responseJSONmessage);
548   - var msg;
549   - Object.keys(o).map(function(k) { msg += k + " " + o[k] + ", " });
550   - return msg.substring(0, msg.length - 2) + ".";
  550 + responseToText: function(responseJSONmessage){
  551 + var o = JSON.parse(responseJSONmessage);
  552 + var msg = "";
  553 + var fn;
  554 +
  555 + for (var key in o) {
  556 + if (o[key] instanceof Array) {
  557 + fn = key;
  558 + for (var i = 0; i < o[key].length; i++) {
  559 + msg += fn + " " + o[key][i] + ", ";
  560 + }
  561 + }
551 562 }
  563 + return msg.substring(0, msg.length - 2) + ".";
  564 + }
552 565 }
553 566 })();
554 567  
... ...
sass/style.sass
... ... @@ -30,10 +30,12 @@
30 30 // 6.10 - imagem destaque do programa, titulo, descricao e botao de acesso
31 31 // 6.11 - login form
32 32 // 6.12 - votacao
33   -// 6.13 - lista de resultados
34   -// 6.14 - paginador
35   -// 6.15 - calendario dos ministros
36   -// 6.16 - listas
  33 +// 6.13 - tabela de resultados
  34 +// 6.14 - lista de resultados
  35 +// 6.15 - paginador
  36 +// 6.16 - calendario dos ministros
  37 +// 6.17 - listas
  38 +// 6.18 - artigo
37 39 // 7 - Modificadores
38 40 // 8 - Cores do Temas
39 41 // 9 - Alto Contraste
... ... @@ -101,7 +103,6 @@ h1
101 103 a
102 104 color: $header-color
103 105 h2
104   - // border-bottom: 1px solid darken(#eeeff1,$darken)
105 106 font-size: $font-size-h2
106 107 font-weight: 500
107 108 margin-bottom: $gutter * 2
... ... @@ -131,6 +132,39 @@ a
131 132 color: $link-color
132 133 &:hover,&:focus
133 134 color: $link-color
  135 +tr
  136 + &:last-child
  137 + td
  138 + &:first-child
  139 + border-bottom-left-radius: 3px
  140 + border-bottom: 0
  141 + border-left: 0
  142 + &:last-child
  143 + border-bottom-right-radius: 3px
  144 + border-bottom: 0
  145 + border-right: 0
  146 +th
  147 + border-bottom: 3px solid
  148 + border-left: 1px solid
  149 + border-right: 1px solid
  150 + padding: 15px 20px
  151 + &:first-child
  152 + border-top-left-radius: $radius
  153 + border-left: 0
  154 + border-top: 0
  155 + &:last-child
  156 + border-top-right-radius: $radius
  157 + border-right: 0
  158 + border-top: 0
  159 +td
  160 + background-color: #eeeff1
  161 + border: 1px solid #fff
  162 + padding: 10px
  163 + text-align: center
  164 + &:first-child
  165 + border-left: 0
  166 + &:last-child
  167 + border-right: 0
134 168  
135 169  
136 170 // ------------------------------------
... ... @@ -615,6 +649,8 @@ h1
615 649 .oauth
616 650 margin-top: $gutter * 0.5
617 651 text-align: right
  652 + .icon
  653 + padding: 3px 0
618 654 .forgot-password
619 655 display: block
620 656 font-size: $font-size-small
... ... @@ -633,7 +669,77 @@ h1
633 669 .like
634 670 display: inline-block
635 671  
636   -// 6.13 - lista de resultados
  672 +// 6.13 - tabela de resultados
  673 +table
  674 + .abstract-text
  675 + width: 80%
  676 + .value
  677 + text-align: center
  678 + width: 10%
  679 + .header
  680 + font-weight: bold
  681 + line-height: 22px
  682 + text-align: center
  683 + .position
  684 + width: 20%
  685 + a
  686 + border: 1px solid #fff
  687 + border-radius: 100%
  688 + color: #fff
  689 + display: inline-block
  690 + font-size: 16px
  691 + height: 30px
  692 + margin-left: 5px
  693 + padding: 2px 0
  694 + text-align: center
  695 + width: 30px
  696 + vertical-align: middle
  697 + transition: all 400ms
  698 + .votes-for
  699 + display: table-cell
  700 + .fa
  701 + background-color: #32dbb5
  702 + border: 2px solid #ffffff
  703 + border-radius: 100%
  704 + color: #fff
  705 + font-size: 16px
  706 + height: 30px
  707 + padding: 5px 0
  708 + text-align: center
  709 + transition: all 200ms ease 0s
  710 + width: 30px
  711 + .votes-against
  712 + display: table-cell
  713 + .fa
  714 + background-color: #DB4127
  715 + border: 2px solid #ffffff
  716 + border-radius: 100%
  717 + color: #fff
  718 + font-size: 16px
  719 + height: 30px
  720 + padding: 5px 0
  721 + text-align: center
  722 + transition: all 200ms ease 0s
  723 + width: 30px
  724 + .truncate
  725 + display: table
  726 + table-layout: fixed
  727 + width: 90%
  728 + .truncated
  729 + overflow-x: hidden
  730 + text-overflow: ellipsis
  731 + white-space: nowrap
  732 +th
  733 + color: #fff
  734 + &.abstract-text
  735 + text-align: left
  736 +td
  737 + &.abstract-text
  738 + text-align: left
  739 + p
  740 + margin: 0
  741 +
  742 +// 6.14 - lista de resultados
637 743 .results-content
638 744 .total
639 745 float: left
... ... @@ -644,7 +750,6 @@ h1
644 750 margin-top: $gutter
645 751 table
646 752 clear: both
647   - font-weight: 300
648 753 tr:nth-child(odd)
649 754 background: #e5e5e5
650 755 td
... ... @@ -668,7 +773,7 @@ h1
668 773 text-overflow: ellipsis
669 774 white-space: nowrap
670 775  
671   -// 6.14 - paginador
  776 +// 6.15 - paginador
672 777 .paging
673 778 padding: $gutter * 0.25
674 779 ul
... ... @@ -696,7 +801,7 @@ h1
696 801 .prev
697 802 border-radius: $radius 0 0 $radius
698 803  
699   -// 6.15 - calendario dos ministros
  804 +// 6.16 - calendario dos ministros
700 805 .slick
701 806 &-slider
702 807 list-style: none
... ... @@ -745,7 +850,7 @@ h1
745 850 &-disabled
746 851 opacity: 0.25
747 852  
748   -// 6.16 - listas
  853 +// 6.17 - listas
749 854 .list-container-border
750 855 border: 3px solid
751 856 border-radius: $radius
... ... @@ -769,6 +874,18 @@ h1
769 874 padding-right: 0
770 875 padding-top: $gutter * 0.25
771 876  
  877 +// 6.18 - artigo
  878 +.article-container
  879 + max-width: 1170px
  880 + margin-left: auto
  881 + margin-right: auto
  882 + .abstract
  883 + font-style: italic
  884 + color: rgb(114, 114, 114)
  885 + margin-bottom: 30px
  886 + margin-top: 10px
  887 + .title
  888 + font-size: 22px
772 889  
773 890 // ------------------------------------
774 891 // 7 - Modificadores
... ... @@ -778,7 +895,10 @@ h2
778 895 color: #6c6c6c
779 896 font-size: $font-size-big
780 897 font-weight: 700
781   - margin: 0
  898 + margin-bottom: $gutter * 0.25
  899 + margin-left: 0
  900 + margin-right: 0
  901 + margin-top: 0
782 902 padding: 0
783 903 text-transform: none
784 904 &.menu
... ... @@ -842,6 +962,16 @@ h3.titulo-destaque
842 962 &-category
843 963 li
844 964 background-color: $color
  965 + table
  966 + .position
  967 + a
  968 + background-color: $color
  969 + +hover($color,$darken)
  970 + th
  971 + background-color: $color
  972 + border-bottom-color: darken($color,$darken)
  973 + border-left-color: lighten($color,$darken)
  974 + border-right-color: lighten($color,$darken)
845 975 .slick
846 976 &-prev,&-next
847 977 color: $color
... ... @@ -891,28 +1021,35 @@ h3.titulo-destaque
891 1021 .contrast
892 1022 background-color: #000
893 1023 color: #fff
  1024 + .background
  1025 + background-color: #000
894 1026 .container
895   - h2,h3,h4,a,p,li,label,.label,.login i
  1027 + h2,h3,h4,a,p,li,label,.label,.login i,.total,.updated-at span
896 1028 color: #fff
897 1029 a
898 1030 text-decoration: underline
899 1031 small
900 1032 color: darken(#fff, 40%)
901   - .button,.show_body a,.login input.button,.box-category li
902   - background-color: #fff
903   - border-color: darken(#fff, 40%)
904   - color: #000
905   - text-decoration: none
906   - +hover(#fff, 40%)
907   - .icon
908   - &-facebook
909   - background-image: url(images/icons/icon-facebook-contrast.png) !important
910   - &-twitter
911   - background-image: url(images/icons/icon-twitter-contrast.png) !important
912   - &-gplus
913   - background-image: url(images/icons/icon-gplus-contrast.png) !important
914   - &-whatsapp
915   - background-image: url(images/icons/icon-whatsapp-contrast.png) !important
  1033 + blockquote
  1034 + border-color: #fff
  1035 + .button,.show_body a,.login input.button,.box-category li
  1036 + background-color: #fff
  1037 + border-color: darken(#fff, 40%)
  1038 + color: #000
  1039 + text-decoration: none
  1040 + +hover(#fff, 40%)
  1041 + span
  1042 + color: #000
  1043 + .icon
  1044 + color: #000 !important
  1045 + text-decoration: none
  1046 + background-color: #fff
  1047 + +hover(#fff,40%)
  1048 + &-vote
  1049 + border-color: darken(#fff, 40%) !important
  1050 + @each $category,$color in $categories
  1051 + &-#{$category}
  1052 + background-image: url(images/icons/#{$category}-contrast.png)
916 1053 .tab
917 1054 a
918 1055 background-color: darken(#fff, 85%)
... ... @@ -923,29 +1060,46 @@ h3.titulo-destaque
923 1060 border-bottom-color: #000
924 1061 #proposal-categories,#proposal-group
925 1062 border-color: #fff
926   - .proposal-category
927   - a
928   - background-color: darken(#fff, 85%) !important
929   - .arrow-box:after
930   - border-bottom-color: darken(#fff, 85%) !important
931   - .select
932   - background-color: darken(#fff, 85%)
933   - section
934   - background-color: darken(#fff, 85%)
935   - &:hover
936   - background-color: darken(#fff, 85%)
937   - .box
  1063 + .proposal
  1064 + &-category
  1065 + a
  1066 + background-color: darken(#fff, 85%) !important
  1067 + .arrow-box:after
  1068 + border-bottom-color: darken(#fff, 85%) !important
  1069 + &-container
938 1070 background-color: #000
939   - .proposal-header
940   - .title, p
941   - background-color: darken(#fff, 85%)
  1071 + +hover(#fff,100%)
  1072 + &-header
  1073 + .title, p
  1074 + background-color: darken(#fff, 85%)
942 1075 .box
943 1076 background-color: darken(#fff, 85%)
944 1077 text-decoration: none
  1078 + &-header
  1079 + background-color: darken(#fff, 85%)
945 1080 &-propostas
946 1081 border-color: #fff
947 1082 &-title,&-subtitle,&-info,&-bottom,.social span,&-header
948 1083 color: #fff
  1084 + .icon span
  1085 + color: #000 !important
  1086 + .select
  1087 + background-color: darken(#fff, 85%)
  1088 + section
  1089 + background-color: darken(#fff, 85%)
  1090 + &:hover
  1091 + background-color: darken(#fff, 85%)
  1092 + .box
  1093 + background-color: #000
  1094 + table
  1095 + .position a
  1096 + background-color: #000
  1097 + .votes-for .fa,.votes-against .fa
  1098 + background-color: #000
  1099 + th,td
  1100 + background-color: #000
  1101 + border-color: #fff
  1102 + color: #fff
949 1103 .slick
950 1104 &-prev,&-next
951 1105 color: #fff
... ... @@ -955,4 +1109,7 @@ h3.titulo-destaque
955 1109 .date,.time
956 1110 color: #fff
957 1111 .bloco-destaque
958   - background: darken(#fff, 85%)
959 1112 \ No newline at end of file
  1113 + background: darken(#fff, 85%)
  1114 + @each $category,$color in $categories
  1115 + .category-#{$category}
  1116 + background-color: darken(#fff, 85%)
... ...