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 | 267 | </div> |
| 268 | 268 | <input type="hidden" id="type" name="article[type]" value="ProposalsDiscussionPlugin::Proposal"> |
| 269 | 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 | 275 | </form> |
| 272 | 276 | <div class="success-proposal-sent success-sent hide button-send"> |
| 273 | 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 | 206 | var requireLoginContainer = loginButton.closest('.require-login-container'); |
| 207 | 207 | |
| 208 | 208 | if(logged_in) { |
| 209 | - $('.logout').show(); | |
| 209 | + Main.showLogout(); | |
| 210 | 210 | if(token){ |
| 211 | 211 | Main.private_token = token; |
| 212 | 212 | } |
| ... | ... | @@ -228,7 +228,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 228 | 228 | } else { |
| 229 | 229 | requireLoginContainer.find('.require-login').hide(); |
| 230 | 230 | requireLoginContainer.find('.login-container').show(); |
| 231 | - $('.logout').hide(); | |
| 231 | + Main.showLogin(); | |
| 232 | 232 | } |
| 233 | 233 | }, |
| 234 | 234 | guid: function() { |
| ... | ... | @@ -561,10 +561,11 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 561 | 561 | } |
| 562 | 562 | }, 300); |
| 563 | 563 | }, |
| 564 | - displaySuccess: function(container, text, timeout) { | |
| 564 | + displaySuccess: function(container, text, timeout, iconClass) { | |
| 565 | 565 | timeout = typeof timeout !== 'undefined' ? timeout : 2000; |
| 566 | 566 | container.css('opacity', 0.1); |
| 567 | 567 | var successPanel = $('.success-panel').clone(); |
| 568 | + successPanel.find('.icon').addClass(iconClass); | |
| 568 | 569 | successPanel.find('.message').html(text); |
| 569 | 570 | successPanel.appendTo(container.closest('.categories')); |
| 570 | 571 | successPanel.show(); |
| ... | ... | @@ -577,6 +578,25 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 577 | 578 | successPanel.remove(); |
| 578 | 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 | 600 | responseToText: function(responseJSONmessage){ |
| 581 | 601 | var o = JSON.parse(responseJSONmessage); |
| 582 | 602 | var msg = ""; |
| ... | ... | @@ -757,7 +777,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 757 | 777 | $form.siblings('.success-sent').show(); |
| 758 | 778 | $form.siblings('.subtitle').hide(); |
| 759 | 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 | 782 | .fail(function( jqxhr, textStatus, error ) { |
| 763 | 783 | var err = textStatus + ', ' + error; |
| ... | ... | @@ -786,10 +806,14 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 786 | 806 | |
| 787 | 807 | if($.cookie('_dialoga_session')) { |
| 788 | 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 | 810 | logged_in = true; |
| 791 | 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 | 831 | } |
| 808 | 832 | }).done(function(data) { |
| 809 | 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 | 835 | }).fail(function(data) { |
| 812 | 836 | message.show(); |
| 813 | 837 | if(data.status==401){ |
| ... | ... | @@ -870,7 +894,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 870 | 894 | data: $(this).parents('.signup').serialize(), |
| 871 | 895 | }).done(function(data) { |
| 872 | 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 | 898 | }).fail(function(data) { |
| 875 | 899 | var msg = Main.responseToText(data.responseJSON.message); |
| 876 | 900 | message.show(); |
| ... | ... | @@ -913,8 +937,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 913 | 937 | $.removeCookie('votedProposals'); |
| 914 | 938 | $.removeCookie('*'); |
| 915 | 939 | logged_in = false; |
| 916 | - $('.logout').hide(); | |
| 917 | - $('.entrar').show(); | |
| 940 | + Main.showLogin(); | |
| 918 | 941 | location.reload(); |
| 919 | 942 | e.preventDefault(); |
| 920 | 943 | }); | ... | ... |
sass/style.sass
| ... | ... | @@ -167,6 +167,15 @@ td |
| 167 | 167 | border-left: 0 |
| 168 | 168 | &:last-child |
| 169 | 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 | 311 | background-color: #32dbb5 |
| 303 | 312 | border-bottom: 3px solid darken(#32dbb5, $darken) !important |
| 304 | 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 | 512 | border: 1px solid |
| 489 | 513 | margin-bottom: $gutter * 1.5 |
| 490 | 514 | margin-top: 0 |
| 491 | - height: 500px | |
| 515 | + height: 570px | |
| 492 | 516 | overflow: auto |
| 493 | 517 | padding: $gutter |
| 494 | 518 | position: relative |
| ... | ... | @@ -645,8 +669,13 @@ h1 |
| 645 | 669 | padding: 2px 10px |
| 646 | 670 | .entrar |
| 647 | 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 | 679 | padding-left: 40px |
| 651 | 680 | .login,.signup |
| 652 | 681 | text-align: left |
| ... | ... | @@ -694,6 +723,10 @@ h1 |
| 694 | 723 | .row |
| 695 | 724 | input |
| 696 | 725 | margin-bottom: 0 |
| 726 | +.maxlength | |
| 727 | + margin: ($gutter * 0.5) 0 ($gutter * 2) | |
| 728 | + text-align: right | |
| 729 | + | |
| 697 | 730 | |
| 698 | 731 | // 6.12 - votacao |
| 699 | 732 | .vote-actions |
| ... | ... | @@ -923,6 +956,7 @@ td |
| 923 | 956 | .success-panel |
| 924 | 957 | position: absolute |
| 925 | 958 | z-index: 100 |
| 959 | + text-align: center | |
| 926 | 960 | |
| 927 | 961 | // ------------------------------------ |
| 928 | 962 | // 7 - Modificadores |
| ... | ... | @@ -980,6 +1014,8 @@ h3.titulo-destaque |
| 980 | 1014 | color: $color |
| 981 | 1015 | a |
| 982 | 1016 | color: $color |
| 1017 | + textarea | |
| 1018 | + border-color: $color | |
| 983 | 1019 | .button,.show_body a |
| 984 | 1020 | background-color: $color |
| 985 | 1021 | border-color: darken($color, $darken) |
| ... | ... | @@ -1022,6 +1058,7 @@ h3.titulo-destaque |
| 1022 | 1058 | +hover($color,$darken) |
| 1023 | 1059 | i |
| 1024 | 1060 | color: $color |
| 1061 | + | |
| 1025 | 1062 | .list |
| 1026 | 1063 | &-unstyled li |
| 1027 | 1064 | color: $color | ... | ... |