Commit 654f2450eb2f7f962f39a85f91011695773c6cc4
1 parent
2ae73809
Exists in
master
and in
5 other branches
Fix require login actions
Showing
2 changed files
with
19 additions
and
16 deletions
Show diff stats
index.html
@@ -245,7 +245,7 @@ | @@ -245,7 +245,7 @@ | ||
245 | </div> | 245 | </div> |
246 | 246 | ||
247 | <div class="row"> | 247 | <div class="row"> |
248 | - <div class="make-proposal-container col-sm-6"> | 248 | + <div class="make-proposal-container col-sm-6 require-login-container"> |
249 | <section class="make-proposal box box-propostas"> | 249 | <section class="make-proposal box box-propostas"> |
250 | <div class="container-title box-title">Faça uma proposta</div> | 250 | <div class="container-title box-title">Faça uma proposta</div> |
251 | <div class="subtitle box-subtitle">Qual a sua sugestão para melhorar este programa?</div> | 251 | <div class="subtitle box-subtitle">Qual a sua sugestão para melhorar este programa?</div> |
@@ -276,7 +276,7 @@ | @@ -276,7 +276,7 @@ | ||
276 | </section> | 276 | </section> |
277 | </div> | 277 | </div> |
278 | 278 | ||
279 | - <div class="support-proposal-container col-sm-6"> | 279 | + <div class="support-proposal-container col-sm-6 require-login-container"> |
280 | <section class="support-proposal box box-propostas box-center box-apoie"> | 280 | <section class="support-proposal box box-propostas box-center box-apoie"> |
281 | <div class="container-title box-title"> Apoie outras propostas</div> | 281 | <div class="container-title box-title"> Apoie outras propostas</div> |
282 | <div class="alert alert-warning hide" role="alert"> | 282 | <div class="alert alert-warning hide" role="alert"> |
@@ -288,7 +288,7 @@ | @@ -288,7 +288,7 @@ | ||
288 | <div class="no-proposals">Ainda não existe nenhuma proposta para este programa.</div> | 288 | <div class="no-proposals">Ainda não existe nenhuma proposta para este programa.</div> |
289 | </div> | 289 | </div> |
290 | <div class="login-container hide">Login</div> | 290 | <div class="login-container hide">Login</div> |
291 | - <div class="send-button"><a href="#"><span>Login</span></a></div> | 291 | + <div class="button-send hide"><a href="#"><span>Login</span></a></div> |
292 | </section> | 292 | </section> |
293 | </div> | 293 | </div> |
294 | 294 | ||
@@ -344,8 +344,8 @@ | @@ -344,8 +344,8 @@ | ||
344 | <p class="box-subtitle">{{stripTags (trimString abstract 200)}}</p> | 344 | <p class="box-subtitle">{{stripTags (trimString abstract 200)}}</p> |
345 | </div> | 345 | </div> |
346 | <div class="vote-actions"> | 346 | <div class="vote-actions"> |
347 | - <a href="#" class="icon icon-vote dislike" data-vote-value="-1"><span class="fa fa-times"></span></a> | ||
348 | - <a href="#" class="icon icon-vote like" data-vote-value="1"><span class="fa fa-check"></span></a> | 347 | + <a href="#" class="icon icon-vote vote-action dislike" data-vote-value="-1"><span class="fa fa-times"></span></a> |
348 | + <a href="#" class="icon icon-vote vote-action like" data-vote-value="1"><span class="fa fa-check"></span></a> | ||
349 | <div class="row"> | 349 | <div class="row"> |
350 | <div class="col-sm-6 col-sm-offset-3"> | 350 | <div class="col-sm-6 col-sm-offset-3"> |
351 | <a href="#" class="skip button box-footer">Pular</a> | 351 | <a href="#" class="skip button box-footer">Pular</a> |
js/main.js
@@ -24,8 +24,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -24,8 +24,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
24 | 24 | ||
25 | //Detects for localhost settings | 25 | //Detects for localhost settings |
26 | var patt = new RegExp(":3000/"); | 26 | var patt = new RegExp(":3000/"); |
27 | - if(patt.test(window.location.href)) | ||
28 | - participa = false; | 27 | + //if(patt.test(window.location.href)) |
28 | + // participa = false; | ||
29 | 29 | ||
30 | if(participa){ | 30 | if(participa){ |
31 | var host = 'http://www.participa.br'; | 31 | var host = 'http://www.participa.br'; |
@@ -97,8 +97,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -97,8 +97,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
97 | contextMain.loadRandomProposal(topic_id); | 97 | contextMain.loadRandomProposal(topic_id); |
98 | e.preventDefault(); | 98 | e.preventDefault(); |
99 | }); | 99 | }); |
100 | - $body.off('click', '.vote-actions .like'); | ||
101 | - $body.on('click', '.vote-actions .like', function(e) { | 100 | + $body.off('click', '.vote-actions .vote-action'); |
101 | + $body.on('click', '.vote-actions .vote-action', function(e) { | ||
102 | //Helps to prevent more than one vote per proposal | 102 | //Helps to prevent more than one vote per proposal |
103 | if(ProposalApp.hasProposalbeenVoted(article.id)){ | 103 | if(ProposalApp.hasProposalbeenVoted(article.id)){ |
104 | console.log("Proposta " + article.id + " já havia sido votada"); | 104 | console.log("Proposta " + article.id + " já havia sido votada"); |
@@ -108,7 +108,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -108,7 +108,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
108 | } | 108 | } |
109 | 109 | ||
110 | if(!logged_in) { | 110 | if(!logged_in) { |
111 | - $(this).closest('.support-proposal').find('.button-send a').click(); | 111 | + $(this).closest('.require-login-container').find('.button-send a').click(); |
112 | e.preventDefault(); | 112 | e.preventDefault(); |
113 | return; | 113 | return; |
114 | } | 114 | } |
@@ -196,17 +196,20 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -196,17 +196,20 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
196 | loginCallback: function(loggedIn, token, user) { | 196 | loginCallback: function(loggedIn, token, user) { |
197 | logged_in = loggedIn; | 197 | logged_in = loggedIn; |
198 | $('.login .message').text(''); | 198 | $('.login .message').text(''); |
199 | + var requireLoginContainer = loginButton.closest('.require-login-container'); | ||
199 | 200 | ||
200 | if(logged_in) { | 201 | if(logged_in) { |
202 | + console.log('A'); | ||
201 | if(token){ | 203 | if(token){ |
202 | Main.private_token = token; | 204 | Main.private_token = token; |
203 | } | 205 | } |
204 | - loginButton.siblings('.require-login').show(); | ||
205 | - loginButton.siblings('.require-login .message').show(); | ||
206 | - loginButton.siblings('.login-container').hide(); | 206 | + requireLoginContainer.find('.require-login').show(); |
207 | + requireLoginContainer.find('.require-login .message').show(); | ||
208 | + requireLoginContainer.find('.login-container').hide(); | ||
207 | $.cookie('_dialoga_session', Main.private_token); | 209 | $.cookie('_dialoga_session', Main.private_token); |
208 | } else if (user) { | 210 | } else if (user) { |
209 | - var loginContainer = loginButton.siblings('.login-container'); | 211 | + console.log('B'); |
212 | + var loginContainer = requireLoginContainer.find('.login-container'); | ||
210 | loginContainer.show(); | 213 | loginContainer.show(); |
211 | loginContainer.find('.new-user').click(); | 214 | loginContainer.find('.new-user').click(); |
212 | var signupForm = loginContainer.find('#signup-form'); | 215 | var signupForm = loginContainer.find('#signup-form'); |
@@ -216,8 +219,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -216,8 +219,8 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
216 | //signupForm.find(".password").hide(); | 219 | //signupForm.find(".password").hide(); |
217 | //signupForm.find(".password-confirmation").hide(); | 220 | //signupForm.find(".password-confirmation").hide(); |
218 | } else { | 221 | } else { |
219 | - loginButton.siblings('.require-login').hide(); | ||
220 | - loginButton.siblings('.login-container').show(); | 222 | + requireLoginContainer.find('.require-login').hide(); |
223 | + requireLoginContainer.find('.login-container').show(); | ||
221 | } | 224 | } |
222 | }, | 225 | }, |
223 | guid: function() { | 226 | guid: function() { |