Commit caabb1a55511d214247c4f92a4135317a95fb8bc
1 parent
0c10ee05
Exists in
master
and in
10 other branches
Pequenos ajustes no main.js
Showing
1 changed file
with
13 additions
and
14 deletions
Show diff stats
js/main.js
... | ... | @@ -245,18 +245,18 @@ function loadRandomProposal(topic_id, private_token) { |
245 | 245 | $resultsContainer.toggle(); |
246 | 246 | |
247 | 247 | if($resultsContainer.is(':visible')) { |
248 | - var $loading = $resultsContainer.find('.loading'); | |
249 | - var $resultsContent = $resultsContainer.find('.results-content'); | |
250 | 248 | |
251 | - $loading.show(); | |
252 | - $resultsContent.hide(); | |
249 | + $resultsContainer.find('.loading').show(); | |
250 | + $resultsContainer.find('.results-content').hide(); | |
253 | 251 | |
254 | 252 | var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=10&order=votes_score&fields=id,name,abstract,votes_for,votes_against&content_type=ProposalsDiscussionPlugin::Proposal'; |
255 | 253 | $.getJSON(url).done(function( data ) { |
256 | 254 | |
257 | 255 | $resultsContainer.html(resultsTemplate(data)); |
258 | - $('.results-container .loading').hide(); | |
259 | - $('.results-container .results-content').show(); | |
256 | + $resultsContainer.find('.loading').hide(); | |
257 | + $resultsContainer.find('.results-content').show(); | |
258 | + | |
259 | + // scroll to the end | |
260 | 260 | $('html, body').animate({ |
261 | 261 | scrollTop: $(document).height() |
262 | 262 | }, 'fast'); |
... | ... | @@ -267,6 +267,7 @@ function loadRandomProposal(topic_id, private_token) { |
267 | 267 | $('.experience-proposal-container').show(); |
268 | 268 | $('.talk-proposal-container').show(); |
269 | 269 | } |
270 | + | |
270 | 271 | e.preventDefault(); |
271 | 272 | }); |
272 | 273 | }); |
... | ... | @@ -396,7 +397,6 @@ function display_proposal_detail(){ |
396 | 397 | $('.talk-proposal-container').hide(); |
397 | 398 | |
398 | 399 | $('.body').show(); |
399 | - $('html, body').animate({ scrollTop: 0 }, 'fast'); | |
400 | 400 | } |
401 | 401 | |
402 | 402 | function display_proposal_by_category(item){ |
... | ... | @@ -451,8 +451,6 @@ function navigateTo(hash){ |
451 | 451 | // go to proposal |
452 | 452 | var proposalId = parts[2]; |
453 | 453 | navigateToProposal(proposalId); |
454 | - | |
455 | - return; | |
456 | 454 | } |
457 | 455 | |
458 | 456 | if( isCategory ){ |
... | ... | @@ -460,14 +458,15 @@ function navigateTo(hash){ |
460 | 458 | // go to category |
461 | 459 | var categoryId = parts[3]; |
462 | 460 | navigateToCategory(categoryId); |
463 | - | |
464 | - return; | |
465 | 461 | } |
466 | 462 | |
467 | 463 | // default |
468 | - // show the 'index' -> category tab | |
469 | - display_category_tab(); | |
470 | - console.log('route not handled', hash); | |
464 | + if( !isProposal && !isCategory ){ | |
465 | + // show the 'index' -> category tab | |
466 | + display_category_tab(); | |
467 | + } | |
468 | + | |
469 | + $('html, body').animate({ scrollTop: 0 }, 'fast'); | |
471 | 470 | } |
472 | 471 | |
473 | 472 | function navigateToProposal(proposalId){ | ... | ... |