Commit 279e0627d30988676c536dc2fc5a2ddcfa68865f
Exists in
master
and in
5 other branches
Merge branch 'master' of https://gitlab.com/participa/proposal-app
Showing
2 changed files
with
189 additions
and
58 deletions
Show diff stats
js/main.js
| ... | ... | @@ -52,7 +52,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 52 | 52 | var API = { |
| 53 | 53 | articles: '', |
| 54 | 54 | proposals: '/api/v1/articles/{topic_id}/children', |
| 55 | - | |
| 55 | + | |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | 58 | API.getProposalsURL = function (topicId){ |
| ... | ... | @@ -63,6 +63,16 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 63 | 63 | return str.replace(new RegExp(pattern, 'g'), value); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + function fillSignupForm(signupForm, user) { | |
| 67 | + signupForm.find('#signup-user_email').val(user.email); | |
| 68 | + signupForm.find('#signup-user_name').val(user.login); | |
| 69 | + signupForm.find('#user_oauth_providers').val(user.oauth_providers); | |
| 70 | + /*signupForm.find('div.password').hide(); | |
| 71 | + signupForm.find('div.password-confirmation').hide(); | |
| 72 | + signupForm.find('#signup-user_password').attr('required', false); | |
| 73 | + signupForm.find('#user_password_confirmation').attr('required', false);*/ | |
| 74 | + }; | |
| 75 | + | |
| 66 | 76 | return { |
| 67 | 77 | private_token: '375bee7e17d0021af7160ce664874618', |
| 68 | 78 | getProposalId: function() { |
| ... | ... | @@ -97,7 +107,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 97 | 107 | if(childId !== 0 && !force){ |
| 98 | 108 | url += '/' + childId; |
| 99 | 109 | } |
| 100 | - url += '?private_token=' + private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,slug,abstract,created_by&content_type=ProposalsDiscussionPlugin::Proposal'; | |
| 110 | + url += '?private_ftoken=' + private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,slug,abstract,created_by&content_type=ProposalsDiscussionPlugin::Proposal'; | |
| 101 | 111 | |
| 102 | 112 | $.getJSON(url).done(function( data ) { |
| 103 | 113 | $loading.hide(); |
| ... | ... | @@ -120,10 +130,12 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 120 | 130 | }); |
| 121 | 131 | $body.off('click', '.vote-actions .vote-action'); |
| 122 | 132 | $body.on('click', '.vote-actions .vote-action', function(e) { |
| 123 | - //Helps to prevent more than one vote per proposal | |
| 124 | - var button = $(this); | |
| 125 | 133 | e.preventDefault(); |
| 126 | 134 | |
| 135 | + //Helps to prevent more than one vote per proposal | |
| 136 | + var $button = $(this); | |
| 137 | + var $proposal = $button.closest('.random-proposal'); | |
| 138 | + | |
| 127 | 139 | if(!logged_in) { |
| 128 | 140 | $(this).closest('.require-login-container').find('.button-send a').click(); |
| 129 | 141 | return; |
| ... | ... | @@ -131,7 +143,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 131 | 143 | |
| 132 | 144 | if(ProposalApp.hasProposalbeenVoted(article.id)){ |
| 133 | 145 | // console.debug("Proposta " + article.id + " já havia sido votada"); |
| 134 | - Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); | |
| 146 | + Main.displaySuccess($button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); | |
| 135 | 147 | contextMain.loadRandomProposal(topic_id, true); |
| 136 | 148 | return; |
| 137 | 149 | } |
| ... | ... | @@ -145,12 +157,35 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 145 | 157 | } |
| 146 | 158 | }).done(function(data) { |
| 147 | 159 | if(data.vote) { |
| 148 | - Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Voto realizado com sucesso', 800); | |
| 160 | + // Main.displaySuccess($button.closest('.support-proposal .section-content'), '', 800); | |
| 161 | + $proposal.find('.abstract').hide(); | |
| 162 | + $proposal.find('.vote-actions .like').hide(); | |
| 163 | + $proposal.find('.vote-actions .dislike').hide(); | |
| 164 | + // $proposal.find('.vote-actions .vote-result').hide(); | |
| 165 | + var $successPanel = $('.success-panel').clone(); | |
| 166 | + $successPanel.find('.icon').addClass('icon-proposal-sent'); | |
| 167 | + $successPanel.find('.message').html('Voto realizado com sucesso'); | |
| 168 | + $successPanel.removeClass('hide'); | |
| 169 | + $proposal.prepend($successPanel); | |
| 170 | + $successPanel.show(); | |
| 171 | + // $successPanel.css('top', Math.max(0, (($proposal.height() - $successPanel.outerHeight()) / 2) + $proposal.offset().top) + 'px'); | |
| 172 | + // $successPanel.css('left', Math.max(0, (($proposal.width() - $successPanel.outerWidth()) / 2) + $proposal.offset().left) + 'px'); | |
| 149 | 173 | } else { |
| 150 | - Main.displaySuccess(button.closest('.support-proposal .section-content'), 'Seu voto já foi computado nesta proposta', 800); | |
| 174 | + $proposal.find('.abstract').hide(); | |
| 175 | + $proposal.find('.vote-actions .like').hide(); | |
| 176 | + $proposal.find('.vote-actions .dislike').hide(); | |
| 177 | + | |
| 178 | + var $successPanel = $('.success-panel').clone(); | |
| 179 | + // $successPanel.find('.icon').addClass('icon-proposal-sent'); | |
| 180 | + $successPanel.find('.message').html('Seu voto já foi computado nesta proposta'); | |
| 181 | + $successPanel.removeClass('hide'); | |
| 182 | + $proposal.prepend($successPanel); | |
| 183 | + $successPanel.show(); | |
| 184 | + // Main.displaySuccess($button.closest('.support-proposal .section-content'), , 800); | |
| 185 | + // $successPanel.find('.message').html('Seu voto já foi computado nesta proposta'); | |
| 151 | 186 | } |
| 152 | - ProposalApp.addVotedProposal(article.id); | |
| 153 | - contextMain.loadRandomProposal(topic_id, true); | |
| 187 | + // ProposalApp.addVotedProposal(article.id); | |
| 188 | + // contextMain.loadRandomProposal(topic_id, true); | |
| 154 | 189 | }); |
| 155 | 190 | }); |
| 156 | 191 | |
| ... | ... | @@ -239,6 +274,10 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 239 | 274 | $('.login .message').text(''); |
| 240 | 275 | var requireLoginContainer = loginButton.closest('.require-login-container'); |
| 241 | 276 | |
| 277 | + if(user && !Main.getUser()) { | |
| 278 | + Main.setUser(user); | |
| 279 | + } | |
| 280 | + | |
| 242 | 281 | if(logged_in) { |
| 243 | 282 | Main.showLogout(); |
| 244 | 283 | if(token){ |
| ... | ... | @@ -251,13 +290,18 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 251 | 290 | $.cookie('_dialoga_session', Main.private_token); |
| 252 | 291 | $('#login-panel').hide(); |
| 253 | 292 | } else if (user) { |
| 254 | - var loginContainer = requireLoginContainer.find('.login-container'); | |
| 255 | - loginContainer.show(); | |
| 256 | - loginContainer.find('.new-user').click(); | |
| 257 | - var $signupForm = loginContainer.find('#signup-form'); | |
| 258 | - $signupForm.find('#user_email').val(user.email); | |
| 259 | - $signupForm.find('#user_name').val(user.login); | |
| 260 | - $signupForm.find('#user_oauth_providers').val(user.oauth_providers); | |
| 293 | + // fluxo signup vindo das caixas de login dentro dos programas | |
| 294 | + if(requireLoginContainer.length > 0){ | |
| 295 | + var loginContainer = requireLoginContainer.find('.login-container'); | |
| 296 | + loginContainer.show(); | |
| 297 | + loginContainer.find('.new-user').click(); | |
| 298 | + var $signupForm = loginContainer.find('#signup-form'); | |
| 299 | + fillSignupForm($signupForm, user); | |
| 300 | + } else { //signup botão Entrar principal vindo de OAUTH | |
| 301 | + $('#login-panel').find('a.new-user').click(); | |
| 302 | + var $signupForm = $('#login-panel #signup-form'); | |
| 303 | + fillSignupForm($signupForm, user); | |
| 304 | + } | |
| 261 | 305 | } else { |
| 262 | 306 | requireLoginContainer.find('.require-login').hide(); |
| 263 | 307 | requireLoginContainer.find('.login-container').show(); |
| ... | ... | @@ -292,7 +336,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 292 | 336 | var proposalsByTheme = $('#proposal-group .proposal-list .proposal-item').find('.' + themeClass); |
| 293 | 337 | var randomizedIndex = Math.floor(Math.random() * proposalsByTheme.length); |
| 294 | 338 | var proposalToShow = $(proposalsByTheme[randomizedIndex]).parents().filter('.proposal-item'); |
| 295 | - $(proposalToShow).show(); | |
| 339 | + $(proposalToShow).show(); | |
| 296 | 340 | }); |
| 297 | 341 | }, |
| 298 | 342 | display_category_tab: function(){ |
| ... | ... | @@ -539,7 +583,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 539 | 583 | var $proposal = $('#proposal-item-' + proposalId); |
| 540 | 584 | proposalTitle = $proposal.find('.title').text(); |
| 541 | 585 | var proposalOffset = $proposal.offset(); |
| 542 | - | |
| 586 | + | |
| 543 | 587 | if(proposalOffset){ |
| 544 | 588 | scrollTop = proposalOffset.top; |
| 545 | 589 | }else{ |
| ... | ... | @@ -696,7 +740,12 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 696 | 740 | var name = ''; |
| 697 | 741 | var user = Main.getUser(); |
| 698 | 742 | if(user){ |
| 699 | - name = user.person.name + ' - '; | |
| 743 | + if(user.person && user.person.name){ | |
| 744 | + name = user.person.name + ' - '; | |
| 745 | + }else{ | |
| 746 | + name = user.login + ' - '; | |
| 747 | + } | |
| 748 | + | |
| 700 | 749 | } |
| 701 | 750 | $('#logout-button .name').text(name); |
| 702 | 751 | $('#logout-button').show(); |
| ... | ... | @@ -724,7 +773,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 724 | 773 | display_events: function(cat_id, active_category) { |
| 725 | 774 | var url = host + '/api/v1/communities/' + dialoga_community + '/articles?categories_ids[]=' + cat_id + '&content_type=Event&private_token=' + '375bee7e17d0021af7160ce664874618'; |
| 726 | 775 | $.getJSON(url).done(function (data) { |
| 727 | - | |
| 776 | + | |
| 728 | 777 | if(data.articles.length === 0){ |
| 729 | 778 | return; |
| 730 | 779 | } |
| ... | ... | @@ -785,7 +834,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 785 | 834 | var maxLinesByParagraph = 0; |
| 786 | 835 | var maxLinesByTitle = 0; |
| 787 | 836 | var $visibleProposals = $('.proposal-list .proposal-item:visible'); |
| 788 | - | |
| 837 | + | |
| 789 | 838 | // get the bigger paragraph |
| 790 | 839 | $visibleProposals.each(function(index, proposalItemEl){ |
| 791 | 840 | var $proposalItemEl = $(proposalItemEl); |
| ... | ... | @@ -796,7 +845,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 796 | 845 | } |
| 797 | 846 | }); |
| 798 | 847 | // console.log('maxLinesByParagraph', maxLinesByParagraph); |
| 799 | - | |
| 848 | + | |
| 800 | 849 | // get the bigger title |
| 801 | 850 | $visibleProposals.each(function(index, proposalItemEl){ |
| 802 | 851 | var $proposalItemEl = $(proposalItemEl); |
| ... | ... | @@ -812,10 +861,10 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 812 | 861 | var $proposalItemEl = $(proposalItemEl); |
| 813 | 862 | var $title = $proposalItemEl.find('.box__title'); |
| 814 | 863 | var $paragraph = $proposalItemEl.find('p'); |
| 815 | - | |
| 864 | + | |
| 816 | 865 | var newTitleHeight = maxLinesByTitle * hPerLineOnTitle; |
| 817 | 866 | var newParagraphHeight = maxLinesByParagraph * hPerLineOnParagraph; |
| 818 | - | |
| 867 | + | |
| 819 | 868 | $title.css('height', newTitleHeight + 'px'); |
| 820 | 869 | $paragraph.css('height', newParagraphHeight + 'px'); |
| 821 | 870 | }); |
| ... | ... | @@ -827,7 +876,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 827 | 876 | computeLines: function ($el) { |
| 828 | 877 | // reset height |
| 829 | 878 | $el.height('auto'); |
| 830 | - | |
| 879 | + | |
| 831 | 880 | var divHeight = $el.height(); |
| 832 | 881 | var lineHeight = parseInt($el.css('lineHeight')); |
| 833 | 882 | var lines = Math.ceil(divHeight / lineHeight); |
| ... | ... | @@ -845,7 +894,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 845 | 894 | }; |
| 846 | 895 | })(); |
| 847 | 896 | |
| 848 | - | |
| 897 | + | |
| 849 | 898 | var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + Main.private_token + '&fields=id,children,categories,abstract,title,image,url,setting,position'; |
| 850 | 899 | |
| 851 | 900 | $.getJSON(noosferoAPI) |
| ... | ... | @@ -879,7 +928,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 879 | 928 | if(url.indexOf('?') !== -1){ |
| 880 | 929 | c = '&'; |
| 881 | 930 | } |
| 882 | - | |
| 931 | + | |
| 883 | 932 | var resultUrl = url + c + 'wmode=opaque'; |
| 884 | 933 | article.abstract = abstract.replace(url, resultUrl); |
| 885 | 934 | // console.log('article.abstract', article.abstract); |
| ... | ... | @@ -887,6 +936,28 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 887 | 936 | |
| 888 | 937 | forceWmodeIframe(data.article); |
| 889 | 938 | |
| 939 | + function removeStylefromIframe (article){ | |
| 940 | + var abstract = article.abstract; | |
| 941 | + | |
| 942 | + var patternIframe = 'style="'; | |
| 943 | + var indexOfIframe = abstract.indexOf('<iframe'); | |
| 944 | + var indexOfStyleOnIframe = abstract.indexOf('style="', indexOfIframe); | |
| 945 | + | |
| 946 | + if(indexOfStyleOnIframe === -1){ | |
| 947 | + return; | |
| 948 | + } | |
| 949 | + | |
| 950 | + var startStyleContent = indexOfStyleOnIframe + patternIframe.length; | |
| 951 | + var endStyleContent = abstract.indexOf('"', startStyleContent); | |
| 952 | + var style = abstract.substring(startStyleContent , endStyleContent); | |
| 953 | + // console.log('style', style); | |
| 954 | + | |
| 955 | + article.abstract = abstract.replace(style, ''); | |
| 956 | + // console.log('article.abstract', article.abstract); | |
| 957 | + } | |
| 958 | + | |
| 959 | + removeStylefromIframe(data.article); | |
| 960 | + | |
| 890 | 961 | resultsPlaceholder.innerHTML = template(data); |
| 891 | 962 | $('.login-container').html(loginTemplate()); |
| 892 | 963 | $('.countdown').maxlength({text: '%left caracteres restantes'}); |
| ... | ... | @@ -930,17 +1001,18 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 930 | 1001 | var $target = $(e.target); |
| 931 | 1002 | |
| 932 | 1003 | var isLoginButton = ($target.attr('id') === 'login-button'); |
| 1004 | + var isLoginButtonIcon = $target.hasClass('icon-login'); | |
| 933 | 1005 | var requireLogin = $target.hasClass('require-main-login'); |
| 934 | 1006 | var isChildOfPanel = ($target.closest(loginPanelId).length !== 0); |
| 935 | 1007 | |
| 936 | - if( !isLoginButton && !isChildOfPanel && !requireLogin ){ | |
| 1008 | + if( !isLoginButton && !isLoginButtonIcon && !isChildOfPanel && !requireLogin ){ | |
| 937 | 1009 | $loginPanel.hide(); |
| 938 | 1010 | } |
| 939 | 1011 | }); |
| 940 | 1012 | |
| 941 | 1013 | // handle esc |
| 942 | 1014 | $(document).keyup(function(e) { |
| 943 | - | |
| 1015 | + | |
| 944 | 1016 | // escape key maps to keycode `27` |
| 945 | 1017 | if (e.keyCode === 27) { // ESC |
| 946 | 1018 | $loginPanel.hide(); |
| ... | ... | @@ -1199,7 +1271,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1199 | 1271 | }); |
| 1200 | 1272 | |
| 1201 | 1273 | $(document).on('click', '.new-user', function(e) { |
| 1202 | - | |
| 1274 | + | |
| 1203 | 1275 | if(window.lastCaptcha){ |
| 1204 | 1276 | window.lastCaptcha.destruir(); |
| 1205 | 1277 | } |
| ... | ... | @@ -1213,28 +1285,33 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1213 | 1285 | |
| 1214 | 1286 | signupForm.find('.password').show(); |
| 1215 | 1287 | signupForm.find('.password-confirmation').show(); |
| 1288 | + | |
| 1289 | + signupForm.find('signup-user_password').attr('required', true); | |
| 1290 | + signupForm.find('#user_password_confirmation').attr('required', true); | |
| 1291 | + | |
| 1216 | 1292 | loginForm.find('.message').hide(); |
| 1217 | 1293 | signupForm.find('#serpro_captcha').empty(); |
| 1218 | - | |
| 1294 | + | |
| 1219 | 1295 | var oCaptcha_serpro_gov_br; |
| 1220 | 1296 | oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); |
| 1221 | 1297 | window.lastCaptcha = oCaptcha_serpro_gov_br; |
| 1222 | 1298 | oCaptcha_serpro_gov_br.clienteId = 'fdbcdc7a0b754ee7ae9d865fda740f17'; |
| 1223 | 1299 | oCaptcha_serpro_gov_br.url = "/captchaserpro" |
| 1224 | 1300 | oCaptcha_serpro_gov_br.criarUI(signupForm.find('#serpro_captcha')[0], 'css', 'serpro_captcha_component_'); |
| 1225 | - | |
| 1301 | + | |
| 1226 | 1302 | e.preventDefault(); |
| 1227 | 1303 | }); |
| 1228 | 1304 | |
| 1229 | 1305 | $(document).on('click', '.cancel-signup', function(e) { |
| 1230 | 1306 | var signupForm = $(this).parents('#signup-form'); |
| 1307 | + signupForm.find('#user_oauth_providers').val(''); | |
| 1231 | 1308 | signupForm.hide(); |
| 1232 | 1309 | signupForm.siblings('#login-form').show(); |
| 1233 | 1310 | e.preventDefault(); |
| 1234 | 1311 | }); |
| 1235 | 1312 | |
| 1236 | 1313 | $(document).on('click', '.confirm-signup', function(e) { |
| 1237 | - | |
| 1314 | + | |
| 1238 | 1315 | var $button = $(this); |
| 1239 | 1316 | var $signupForm = $(this).parents('form.signup'); |
| 1240 | 1317 | var $inputEmail = $signupForm.find('#signup-user_email'); |
| ... | ... | @@ -1243,7 +1320,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1243 | 1320 | var $inputPasswordConfirmation = $signupForm.find('#user_password_confirmation'); |
| 1244 | 1321 | var $inputAcceptation = $signupForm.find('#user_terms_accepted'); |
| 1245 | 1322 | var $inputCaptcha = $signupForm.find('#captcha_text'); |
| 1246 | - | |
| 1323 | + | |
| 1247 | 1324 | // clear messages |
| 1248 | 1325 | var message = $('.signup .message'); |
| 1249 | 1326 | message.hide(); |
| ... | ... | @@ -1252,9 +1329,19 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1252 | 1329 | // Validate form |
| 1253 | 1330 | var hasEmail = $inputEmail && $inputEmail.val().length > 0; |
| 1254 | 1331 | var hasUsername = $inputUsername && $inputUsername.val().length > 0; |
| 1255 | - var hasPassword = $inputPassword && $inputPassword.val().length > 0; | |
| 1256 | - var hasPasswordConfirmation = $inputPasswordConfirmation && $inputPasswordConfirmation.val().length > 0; | |
| 1257 | - var hasPasswordEquals = $inputPassword.val() === $inputPasswordConfirmation.val(); | |
| 1332 | + | |
| 1333 | + var isOAUTH = $signupForm.find('#user_oauth_providers').val() !== ''; | |
| 1334 | + | |
| 1335 | + var hasPassword = true; | |
| 1336 | + var hasPasswordConfirmation = true; | |
| 1337 | + var hasPasswordEquals = true; | |
| 1338 | + | |
| 1339 | + //if(! isOAUTH){ | |
| 1340 | + hasPassword = $inputPassword && $inputPassword.val().length > 0; | |
| 1341 | + hasPasswordConfirmation = $inputPasswordConfirmation && $inputPasswordConfirmation.val().length > 0; | |
| 1342 | + hasPasswordEquals = $inputPassword.val() === $inputPasswordConfirmation.val(); | |
| 1343 | + //} | |
| 1344 | + | |
| 1258 | 1345 | var hasAcceptation = $inputAcceptation.val(); |
| 1259 | 1346 | var hasCaptcha = $inputCaptcha.val().length > 0; |
| 1260 | 1347 | var hasError = (!hasEmail || !hasUsername || !hasPassword || !hasPasswordConfirmation || !hasPasswordEquals || !hasAcceptation || !hasCaptcha); |
| ... | ... | @@ -1266,32 +1353,35 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1266 | 1353 | |
| 1267 | 1354 | var messageErrors = []; |
| 1268 | 1355 | |
| 1356 | + | |
| 1269 | 1357 | messageErrors.push('<ul>'); // start a HTML list |
| 1270 | - | |
| 1358 | + | |
| 1271 | 1359 | if (!hasEmail){ |
| 1272 | 1360 | messageErrors.push('<li>O e-mail é um campo obrigatório.</li>'); |
| 1273 | 1361 | } |
| 1274 | - | |
| 1362 | + | |
| 1275 | 1363 | if (!hasUsername){ |
| 1276 | 1364 | messageErrors.push('<li>O nome de usuário é um campo obrigatório.</li>'); |
| 1277 | 1365 | } |
| 1278 | - | |
| 1279 | - if (!hasPassword){ | |
| 1280 | - messageErrors.push('<li>A senha é um campo obrigatório.</li>'); | |
| 1281 | - } | |
| 1282 | - | |
| 1283 | - if (!hasPasswordConfirmation){ | |
| 1284 | - messageErrors.push('<li>A confirmação da senha é um campo obrigatório.</li>'); | |
| 1285 | - } | |
| 1286 | - | |
| 1287 | - if (!hasPasswordEquals){ | |
| 1288 | - messageErrors.push('<li>A senha e confirmação da senha devem ser iguais.</li>'); | |
| 1366 | + | |
| 1367 | + if(!isOAUTH){ | |
| 1368 | + if (!hasPassword){ | |
| 1369 | + messageErrors.push('<li>A senha é um campo obrigatório.</li>'); | |
| 1370 | + } | |
| 1371 | + | |
| 1372 | + if (!hasPasswordConfirmation){ | |
| 1373 | + messageErrors.push('<li>A confirmação da senha é um campo obrigatório.</li>'); | |
| 1374 | + } | |
| 1375 | + | |
| 1376 | + if (!hasPasswordEquals){ | |
| 1377 | + messageErrors.push('<li>A senha e confirmação da senha devem ser iguais.</li>'); | |
| 1378 | + } | |
| 1289 | 1379 | } |
| 1290 | - | |
| 1380 | + | |
| 1291 | 1381 | if (!hasAcceptation){ |
| 1292 | 1382 | messageErrors.push('<li>Você deve ler e aceitar os termos de uso.</li>'); |
| 1293 | 1383 | } |
| 1294 | - | |
| 1384 | + | |
| 1295 | 1385 | if (!hasCaptcha){ |
| 1296 | 1386 | messageErrors.push('<li>O ReCaptcha é um campo obrigatório.</li>'); |
| 1297 | 1387 | } |
| ... | ... | @@ -1358,6 +1448,30 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1358 | 1448 | } |
| 1359 | 1449 | }); |
| 1360 | 1450 | |
| 1451 | + var popupCenter = function(url, title, w, h) { | |
| 1452 | + var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; | |
| 1453 | + var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; | |
| 1454 | + | |
| 1455 | + var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; | |
| 1456 | + var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; | |
| 1457 | + | |
| 1458 | + var left = ((width / 2) - (w / 2)) + dualScreenLeft; | |
| 1459 | + var top = ((height / 3) - (h / 3)) + dualScreenTop; | |
| 1460 | + | |
| 1461 | + var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); | |
| 1462 | + | |
| 1463 | + // Puts focus on the newWindow | |
| 1464 | + if (window.focus) { | |
| 1465 | + newWindow.focus(); | |
| 1466 | + } | |
| 1467 | + }; | |
| 1468 | + | |
| 1469 | + $(document).on('click', '.social a.popup', {}, function popUp(e) { | |
| 1470 | + var self = $(this); | |
| 1471 | + popupCenter(self.attr('href'), self.find('.rrssb-text').html(), 580, 470); | |
| 1472 | + e.preventDefault(); | |
| 1473 | + }); | |
| 1474 | + | |
| 1361 | 1475 | $(document).on('click', '#logout-button', function (e){ |
| 1362 | 1476 | $.removeCookie('_dialoga_session'); |
| 1363 | 1477 | $.removeCookie('votedProposals'); |
| ... | ... | @@ -1395,7 +1509,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1395 | 1509 | // if(url.indexOf('?') !== -1){ |
| 1396 | 1510 | // c = '&'; |
| 1397 | 1511 | // } |
| 1398 | - | |
| 1512 | + | |
| 1399 | 1513 | // $iframe.attr("src",url+c+"wmode=opaque"); |
| 1400 | 1514 | // // console.debug('iframe changed to opaque mode'); |
| 1401 | 1515 | // }); |
| ... | ... | @@ -1431,7 +1545,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1431 | 1545 | |
| 1432 | 1546 | return function debounced () { |
| 1433 | 1547 | var obj = this, args = arguments; |
| 1434 | - | |
| 1548 | + | |
| 1435 | 1549 | function delayed () { |
| 1436 | 1550 | if (!execAsap){ |
| 1437 | 1551 | func.apply(obj, args); |
| ... | ... | @@ -1449,7 +1563,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 1449 | 1563 | }; |
| 1450 | 1564 | }; |
| 1451 | 1565 | |
| 1452 | - // smartresize | |
| 1566 | + // smartresize | |
| 1453 | 1567 | jQuery.fn[sr] = function(fn){ |
| 1454 | 1568 | return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); |
| 1455 | 1569 | }; | ... | ... |
sass/style.sass
| ... | ... | @@ -425,6 +425,8 @@ h1 |
| 425 | 425 | // 6.3 - video |
| 426 | 426 | #content |
| 427 | 427 | margin-bottom: $gutter * 1.5 |
| 428 | + .embed-responsive | |
| 429 | + border: 1px solid #333 | |
| 428 | 430 | |
| 429 | 431 | // 6.4 - background do conteudo |
| 430 | 432 | .content |
| ... | ... | @@ -1212,11 +1214,23 @@ td |
| 1212 | 1214 | clear: both |
| 1213 | 1215 | content: " " |
| 1214 | 1216 | display: table |
| 1215 | - #serpro_captcha_component_img_captcha_serpro_gov_br | |
| 1217 | + #divContainerUI_captcha_serpro_gov_br | |
| 1218 | + border: none | |
| 1219 | + box-shadow: none | |
| 1220 | + width: 250px | |
| 1221 | + #img_captcha_serpro_gov_br | |
| 1216 | 1222 | float: left |
| 1217 | - #serpro_captcha_component_divButtons_captcha_serpro_gov_br | |
| 1223 | + #divButtons_captcha_serpro_gov_br | |
| 1218 | 1224 | float: left |
| 1219 | - margin: 10px | |
| 1225 | + width: 100px | |
| 1226 | + img | |
| 1227 | + float: left | |
| 1228 | + margin: 0 0 0 10px | |
| 1229 | + | |
| 1230 | +// 6.22 - random proposal | |
| 1231 | +.random-proposal > .success-panel | |
| 1232 | + position: relative | |
| 1233 | + margin-bottom: 10px | |
| 1220 | 1234 | |
| 1221 | 1235 | // ------------------------------------ |
| 1222 | 1236 | // 7 - Modificadores |
| ... | ... | @@ -1462,6 +1476,9 @@ h3.titulo-destaque |
| 1462 | 1476 | .embed-responsive |
| 1463 | 1477 | margin-left: $gutter * (-1) |
| 1464 | 1478 | margin-right: $gutter * (-1) |
| 1479 | + iframe | |
| 1480 | + left: 0 !important | |
| 1481 | + | |
| 1465 | 1482 | .themes |
| 1466 | 1483 | margin-bottom: $gutter * 1.5 |
| 1467 | 1484 | margin-left: $gutter * 1.5 * (-1) | ... | ... |