Commit b44e80e4abf0ceb36b528d6d0269aafdc2f33cf1

Authored by Leandro Santos
1 parent abca846f

load proposal detail correctly closes #110

Showing 1 changed file with 7 additions and 10 deletions   Show diff stats
js/main.js
... ... @@ -399,11 +399,12 @@ define(['handlebars'], function(Handlebars){
399 399 $('.results-container').hide();
400 400 $('.experience-proposal-container').hide();
401 401 $('.talk-proposal-container').hide();
402   - $('.body').show();
  402 + $('#proposal-item-' + proposal_id + '.proposal-detail').show();
  403 + $('#proposal-item-' + proposal_id +' .body').show();
403 404  
404 405 var url = host + '/api/v1/articles/' + proposal_id + '?private_token=' + private_token + '&fields=id,body&content_type=ProposalsDiscussionPlugin::Topic';
405 406 $.getJSON(url).done(function( data ) {
406   - $('.body-content').replaceWith(data.article.body);
  407 + $('#proposal-item-' + proposal_id +' .body-content').html(data.article.body);
407 408 })
408 409 .fail(function( jqxhr, textStatus, error ) {
409 410 var err = textStatus + ', ' + error;
... ... @@ -535,17 +536,13 @@ define(['handlebars'], function(Handlebars){
535 536 }
536 537  
537 538 function navigateToProposal(proposalId){
  539 + var regexSubpages = /sobre-o-programa$/;
538 540 if(proposalId === undefined){
539 541 display_proposals_tab();
540   - }else{
  542 + }else if(regexSubpages.exec(window.location.hash) == null){
541 543 display_proposal('proposal-item-' + proposalId);
542   -
543   - // show sub-page
544   - var regexSubpages = /sobre-o-programa$/;
545   - var m;
546   - if((m = regexSubpages.exec(window.location.hash)) !== null ){
547   - display_proposal_detail(proposalId);
548   - }
  544 + }else{
  545 + display_proposal_detail(proposalId);
549 546 }
550 547 }
551 548  
... ...