Commit f6e79cd53c43b3a31c2aff71f60c1601e9da73fd
Exists in
master
and in
5 other branches
Merge branch 'master' of gitlab.com:participa/proposal-app
Conflicts: js/main.js
Showing
6 changed files
with
78 additions
and
14 deletions
Show diff stats
3.2 KB
2.89 KB
3.2 KB
index.html
@@ -267,7 +267,11 @@ | @@ -267,7 +267,11 @@ | ||
267 | </div> | 267 | </div> |
268 | <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal"> | 268 | <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal"> |
269 | <input type="hidden" id="content_type" name="content_type" value="ProposalsDiscussionPlugin::Proposal"> | 269 | <input type="hidden" id="content_type" name="content_type" value="ProposalsDiscussionPlugin::Proposal"> |
270 | - <input type="submit" id="make-proposal-button" name="make-proposal-button" class="make-proposal-button" value="Enviar"> | 270 | + <div class="row"> |
271 | + <div class="col-sm-6 col-sm-offset-3"> | ||
272 | + <input type="submit" id="make-proposal-button" name="make-proposal-button" class="make-proposal-button button" value="Enviar"> | ||
273 | + </div> | ||
274 | + </div> | ||
271 | </form> | 275 | </form> |
272 | <div class="success-proposal-sent success-sent hide button-send"> | 276 | <div class="success-proposal-sent success-sent hide button-send"> |
273 | <p>Sua proposta foi encaminhada com sucesso! Ela se tornará pública em até 24 horas e poderá ser apoiada por outros participantes.</p> | 277 | <p>Sua proposta foi encaminhada com sucesso! Ela se tornará pública em até 24 horas e poderá ser apoiada por outros participantes.</p> |
js/main.js
@@ -206,7 +206,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -206,7 +206,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
206 | var requireLoginContainer = loginButton.closest('.require-login-container'); | 206 | var requireLoginContainer = loginButton.closest('.require-login-container'); |
207 | 207 | ||
208 | if(logged_in) { | 208 | if(logged_in) { |
209 | - $('.logout').show(); | 209 | + Main.showLogout(); |
210 | if(token){ | 210 | if(token){ |
211 | Main.private_token = token; | 211 | Main.private_token = token; |
212 | } | 212 | } |
@@ -228,7 +228,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -228,7 +228,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
228 | } else { | 228 | } else { |
229 | requireLoginContainer.find('.require-login').hide(); | 229 | requireLoginContainer.find('.require-login').hide(); |
230 | requireLoginContainer.find('.login-container').show(); | 230 | requireLoginContainer.find('.login-container').show(); |
231 | - $('.logout').hide(); | 231 | + Main.showLogin(); |
232 | } | 232 | } |
233 | }, | 233 | }, |
234 | guid: function() { | 234 | guid: function() { |
@@ -561,10 +561,11 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -561,10 +561,11 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
561 | } | 561 | } |
562 | }, 300); | 562 | }, 300); |
563 | }, | 563 | }, |
564 | - displaySuccess: function(container, text, timeout) { | 564 | + displaySuccess: function(container, text, timeout, iconClass) { |
565 | timeout = typeof timeout !== 'undefined' ? timeout : 2000; | 565 | timeout = typeof timeout !== 'undefined' ? timeout : 2000; |
566 | container.css('opacity', 0.1); | 566 | container.css('opacity', 0.1); |
567 | var successPanel = $('.success-panel').clone(); | 567 | var successPanel = $('.success-panel').clone(); |
568 | + successPanel.find('.icon').addClass(iconClass); | ||
568 | successPanel.find('.message').html(text); | 569 | successPanel.find('.message').html(text); |
569 | successPanel.appendTo(container.closest('.categories')); | 570 | successPanel.appendTo(container.closest('.categories')); |
570 | successPanel.show(); | 571 | successPanel.show(); |
@@ -577,6 +578,25 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -577,6 +578,25 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
577 | successPanel.remove(); | 578 | successPanel.remove(); |
578 | }, timeout); | 579 | }, timeout); |
579 | }, | 580 | }, |
581 | + setUser: function(user){ | ||
582 | + this.user = user; | ||
583 | + }, | ||
584 | + getUser: function(){ | ||
585 | + return this.user; | ||
586 | + }, | ||
587 | + showLogin: function(){ | ||
588 | + $('.entrar').show(); | ||
589 | + $('.logout').hide(); | ||
590 | + }, | ||
591 | + showLogout: function(){ | ||
592 | + $('.entrar').hide(); | ||
593 | + var name = ''; | ||
594 | + if(this.user){ | ||
595 | + name = this.user.person.name + ' | '; | ||
596 | + } | ||
597 | + $('.logout').text(name + 'Sair'); | ||
598 | + $('.logout').show(); | ||
599 | + }, | ||
580 | responseToText: function(responseJSONmessage){ | 600 | responseToText: function(responseJSONmessage){ |
581 | var o = JSON.parse(responseJSONmessage); | 601 | var o = JSON.parse(responseJSONmessage); |
582 | var msg = ""; | 602 | var msg = ""; |
@@ -757,7 +777,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -757,7 +777,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
757 | $form.siblings('.success-sent').show(); | 777 | $form.siblings('.success-sent').show(); |
758 | $form.siblings('.subtitle').hide(); | 778 | $form.siblings('.subtitle').hide(); |
759 | $form.siblings('.info').hide(); | 779 | $form.siblings('.info').hide(); |
760 | - Main.displaySuccess($form.closest('.make-proposal .section-content'), 'Proposta enviada com sucesso', 2000); | 780 | + Main.displaySuccess($form.closest('.make-proposal .section-content'), 'Proposta enviada com sucesso', 2000, 'icon-proposal-sent'); |
761 | }) | 781 | }) |
762 | .fail(function( jqxhr, textStatus, error ) { | 782 | .fail(function( jqxhr, textStatus, error ) { |
763 | var err = textStatus + ', ' + error; | 783 | var err = textStatus + ', ' + error; |
@@ -786,10 +806,14 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -786,10 +806,14 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
786 | 806 | ||
787 | if($.cookie('_dialoga_session')) { | 807 | if($.cookie('_dialoga_session')) { |
788 | var url = host + '/api/v1/users/me?private_token=' + $.cookie('_dialoga_session'); | 808 | var url = host + '/api/v1/users/me?private_token=' + $.cookie('_dialoga_session'); |
789 | - $.getJSON(url).done(function( /*data*/ ) { | 809 | + $.getJSON(url).done(function( data ) { |
790 | logged_in = true; | 810 | logged_in = true; |
791 | Main.private_token = $.cookie('_dialoga_session'); | 811 | Main.private_token = $.cookie('_dialoga_session'); |
792 | - setTimeout(function(){ $('.logout').show(); }, 2000); | 812 | + |
813 | + if(data && data.user){ | ||
814 | + Main.setUser(data.user); | ||
815 | + Main.showLogout(); | ||
816 | + } | ||
793 | }); | 817 | }); |
794 | } | 818 | } |
795 | 819 | ||
@@ -807,7 +831,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -807,7 +831,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
807 | } | 831 | } |
808 | }).done(function(data) { | 832 | }).done(function(data) { |
809 | Main.loginCallback(true, data.private_token); | 833 | Main.loginCallback(true, data.private_token); |
810 | - Main.displaySuccess(button.closest('.section-content'), 'Login efetuado com sucesso', 1000); | 834 | + Main.displaySuccess(button.closest('.section-content'), 'Login efetuado com sucesso', 1000, 'icon-login-success'); |
811 | }).fail(function(data) { | 835 | }).fail(function(data) { |
812 | message.show(); | 836 | message.show(); |
813 | if(data.status==401){ | 837 | if(data.status==401){ |
@@ -870,7 +894,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -870,7 +894,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
870 | data: $(this).parents('.signup').serialize(), | 894 | data: $(this).parents('.signup').serialize(), |
871 | }).done(function(data) { | 895 | }).done(function(data) { |
872 | Main.loginCallback(true, data.private_token); | 896 | Main.loginCallback(true, data.private_token); |
873 | - Main.displaySuccess(button.closest('.section-content'), 'Cadastro efetuado com sucesso', 1000); | 897 | + Main.displaySuccess(button.closest('.section-content'), 'Cadastro efetuado com sucesso', 1000, 'icon-user-created'); |
874 | }).fail(function(data) { | 898 | }).fail(function(data) { |
875 | var msg = Main.responseToText(data.responseJSON.message); | 899 | var msg = Main.responseToText(data.responseJSON.message); |
876 | message.show(); | 900 | message.show(); |
@@ -913,8 +937,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -913,8 +937,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
913 | $.removeCookie('votedProposals'); | 937 | $.removeCookie('votedProposals'); |
914 | $.removeCookie('*'); | 938 | $.removeCookie('*'); |
915 | logged_in = false; | 939 | logged_in = false; |
916 | - $('.logout').hide(); | ||
917 | - $('.entrar').show(); | 940 | + Main.showLogin(); |
918 | location.reload(); | 941 | location.reload(); |
919 | e.preventDefault(); | 942 | e.preventDefault(); |
920 | }); | 943 | }); |
sass/style.sass
@@ -167,6 +167,15 @@ td | @@ -167,6 +167,15 @@ td | ||
167 | border-left: 0 | 167 | border-left: 0 |
168 | &:last-child | 168 | &:last-child |
169 | border-right: 0 | 169 | border-right: 0 |
170 | +input | ||
171 | + width: 100% | ||
172 | +textarea | ||
173 | + border: 1px solid | ||
174 | + padding-bottom: $gutter * 0.25 | ||
175 | + padding-left: $gutter * 0.5 | ||
176 | + padding-right: $gutter * 0.5 | ||
177 | + padding-top: $gutter * 0.25 | ||
178 | + width: 100% | ||
170 | 179 | ||
171 | 180 | ||
172 | // ------------------------------------ | 181 | // ------------------------------------ |
@@ -302,6 +311,21 @@ td | @@ -302,6 +311,21 @@ td | ||
302 | background-color: #32dbb5 | 311 | background-color: #32dbb5 |
303 | border-bottom: 3px solid darken(#32dbb5, $darken) !important | 312 | border-bottom: 3px solid darken(#32dbb5, $darken) !important |
304 | +hover(#32dbb5, $darken) | 313 | +hover(#32dbb5, $darken) |
314 | + &-user-created | ||
315 | + height: 71px | ||
316 | + width: 71px | ||
317 | + background: url(images/icons/icon-user-created.png) no-repeat 50% 50% | ||
318 | + border-radius: 0 | ||
319 | + &-login-success | ||
320 | + height: 71px | ||
321 | + width: 71px | ||
322 | + background: url(images/icons/icon-login-success.png) no-repeat 50% 50% | ||
323 | + border-radius: 0 | ||
324 | + &-proposal-sent | ||
325 | + height: 71px | ||
326 | + width: 71px | ||
327 | + background: url(images/icons/icon-proposal-sent.png) no-repeat 50% 50% | ||
328 | + border-radius: 0 | ||
305 | 329 | ||
306 | 330 | ||
307 | // ------------------------------------ | 331 | // ------------------------------------ |
@@ -488,7 +512,7 @@ h1 | @@ -488,7 +512,7 @@ h1 | ||
488 | border: 1px solid | 512 | border: 1px solid |
489 | margin-bottom: $gutter * 1.5 | 513 | margin-bottom: $gutter * 1.5 |
490 | margin-top: 0 | 514 | margin-top: 0 |
491 | - height: 500px | 515 | + height: 570px |
492 | overflow: auto | 516 | overflow: auto |
493 | padding: $gutter | 517 | padding: $gutter |
494 | position: relative | 518 | position: relative |
@@ -645,8 +669,13 @@ h1 | @@ -645,8 +669,13 @@ h1 | ||
645 | padding: 2px 10px | 669 | padding: 2px 10px |
646 | .entrar | 670 | .entrar |
647 | background: url(images/icons/icon-user.png) no-repeat 20px 50% | 671 | background: url(images/icons/icon-user.png) no-repeat 20px 50% |
648 | - border-left: 1px solid #bcbcbc | ||
649 | - margin-left: 20px | 672 | + // border-left: 1px solid #bcbcbc |
673 | + // margin-left: 20px | ||
674 | + padding-left: 40px | ||
675 | + .logout | ||
676 | + background: url(images/icons/icon-user.png) no-repeat 20px 50% | ||
677 | + // border-left: 1px solid #bcbcbc | ||
678 | + // margin-left: 20px | ||
650 | padding-left: 40px | 679 | padding-left: 40px |
651 | .login,.signup | 680 | .login,.signup |
652 | text-align: left | 681 | text-align: left |
@@ -694,6 +723,10 @@ h1 | @@ -694,6 +723,10 @@ h1 | ||
694 | .row | 723 | .row |
695 | input | 724 | input |
696 | margin-bottom: 0 | 725 | margin-bottom: 0 |
726 | +.maxlength | ||
727 | + margin: ($gutter * 0.5) 0 ($gutter * 2) | ||
728 | + text-align: right | ||
729 | + | ||
697 | 730 | ||
698 | // 6.12 - votacao | 731 | // 6.12 - votacao |
699 | .vote-actions | 732 | .vote-actions |
@@ -923,6 +956,7 @@ td | @@ -923,6 +956,7 @@ td | ||
923 | .success-panel | 956 | .success-panel |
924 | position: absolute | 957 | position: absolute |
925 | z-index: 100 | 958 | z-index: 100 |
959 | + text-align: center | ||
926 | 960 | ||
927 | // ------------------------------------ | 961 | // ------------------------------------ |
928 | // 7 - Modificadores | 962 | // 7 - Modificadores |
@@ -980,6 +1014,8 @@ h3.titulo-destaque | @@ -980,6 +1014,8 @@ h3.titulo-destaque | ||
980 | color: $color | 1014 | color: $color |
981 | a | 1015 | a |
982 | color: $color | 1016 | color: $color |
1017 | + textarea | ||
1018 | + border-color: $color | ||
983 | .button,.show_body a | 1019 | .button,.show_body a |
984 | background-color: $color | 1020 | background-color: $color |
985 | border-color: darken($color, $darken) | 1021 | border-color: darken($color, $darken) |
@@ -1022,6 +1058,7 @@ h3.titulo-destaque | @@ -1022,6 +1058,7 @@ h3.titulo-destaque | ||
1022 | +hover($color,$darken) | 1058 | +hover($color,$darken) |
1023 | i | 1059 | i |
1024 | color: $color | 1060 | color: $color |
1061 | + | ||
1025 | .list | 1062 | .list |
1026 | &-unstyled li | 1063 | &-unstyled li |
1027 | color: $color | 1064 | color: $color |