Commit e99bdac03238fb5e111f609d64b98364f94d17b2

Authored by Victor Costa
1 parent 28761672

Display terms of use link

index.html
... ... @@ -105,6 +105,8 @@
105 105 <h1><a href="#">{{article.title}}</a></h1>
106 106 </header>
107 107  
  108 + <div id="article-container" class="hide"></div>
  109 +
108 110 <div id="content">
109 111 {{{article.abstract}}}
110 112 </div>
... ... @@ -431,6 +433,22 @@
431 433 </ul>
432 434 </script>
433 435  
  436 + <script id="article" type="text/x-handlebars-template">
  437 + <div class="title">
  438 + {{{title}}}
  439 + </div>
  440 + <div class="abstract">
  441 + {{{abstract}}}
  442 + </div>
  443 + <div class="body">
  444 + {{{body}}}
  445 + </div>
  446 + </script>
  447 +
  448 + <div class="terms-of-use">
  449 + <a href="#/artigo/107880">Termos de uso</a>
  450 + </div>
  451 +
434 452 <script type='text/javascript' >
435 453 loadRequireJS();
436 454 </script>
... ...
js/main.js
... ... @@ -9,6 +9,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
9 9 var supportProposalTemplate = Handlebars.compile(document.getElementById('support-proposal-template').innerHTML);
10 10 var loginTemplate = Handlebars.compile(document.getElementById('login').innerHTML);
11 11 var resultsTemplate = Handlebars.compile(document.getElementById('results').innerHTML);
  12 + var articleTemplate = Handlebars.compile(document.getElementById('article').innerHTML);
12 13  
13 14 // The div/container that we are going to display the results in
14 15 var resultsPlaceholder = document.getElementById('proposal-result');
... ... @@ -225,6 +226,17 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
225 226 }
226 227 return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
227 228 },
  229 + display_article: function(article_id) {
  230 + var url = host + '/api/v1/articles/' + article_id + '?private_token=' + Main.private_token;
  231 + $.getJSON(url).done(function( data ) {
  232 + $('#article-container').html(articleTemplate(data.article));
  233 + $('#article-container').show();
  234 + $('#proposal-categories').hide();
  235 + $('#proposal-group').hide();
  236 + $('nav').hide();
  237 + $('#content').hide();
  238 + });
  239 + },
228 240 display_category_tab: function(){
229 241 $('#proposal-group').hide();
230 242 $('#proposal-categories').show();
... ... @@ -233,6 +245,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
233 245 $('.proposal-category-items').hide();
234 246 $('.proposal-category .arrow-box').hide();
235 247 $('.proposal-detail').hide();
  248 + $('#article-container').hide();
236 249  
237 250 $('#content').show();
238 251 $('nav').show();
... ... @@ -243,6 +256,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
243 256 $('#nav-proposal-group a').addClass('active');
244 257 $('#nav-proposal-categories a').removeClass('active');
245 258 $('#content').show();
  259 + $('#article-container').hide();
246 260 $('nav').show();
247 261 },
248 262 display_proposal: function(proposal_id){
... ... @@ -250,6 +264,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
250 264 $('#proposal-group').hide();
251 265 $('nav').hide();
252 266 $('#content').hide();
  267 + $('#article-container').hide();
253 268 // $('.make-proposal-form').hide();
254 269 // $('.login-container').hide();
255 270 $('.proposal-detail').hide(); // hide all proposals
... ... @@ -293,6 +308,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
293 308 $('#proposal-group').hide();
294 309 $('nav').hide();
295 310 $('#content').hide();
  311 + $('#article-container').hide();
296 312 $proposal = $('#proposal-item-' + proposal_id);
297 313 $proposal.find('.make-proposal-form').hide();
298 314 $proposal.find('.proposal-header').hide();
... ... @@ -403,6 +419,7 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
403 419 var regexProposals = /#\/programas/;
404 420 var regexCategory = /#\/temas/;
405 421 var regexHideBarra = /barra=false$/;
  422 + var regexArticle = /#\/artigo/;
406 423  
407 424 if( !(regexHideBarra.exec(hash) !== null) && !HIDE_BARRA_DO_GOVERNO ){
408 425 this.addBarraDoGoverno();
... ... @@ -417,6 +434,11 @@ define([&#39;handlebars&#39;, &#39;fastclick&#39;, &#39;handlebars_helpers&#39;], function(Handlebars, F
417 434  
418 435 var isProposal = regexProposals.exec(hash) !== null;
419 436 var isCategory = regexCategory.exec(hash) !== null;
  437 + var isArticle = regexArticle.exec(hash) !== null;
  438 +
  439 + if(isArticle) {
  440 + this.display_article(hash.split('/')[2]);
  441 + }
420 442  
421 443 if( isProposal ){
422 444  
... ...
sass/_article.scss 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +#article-container .abstract {
  2 + font-style: italic;
  3 + color: rgb(114, 114, 114);
  4 + margin-bottom: 30px;
  5 + margin-top: 10px;
  6 +}
  7 +
  8 +#article-container .title {
  9 + font-size: 22px;
  10 +}
... ...
sass/_footer.scss
1 1 footer {
2 2 // display: none;
3 3 }
  4 +
  5 +.terms-of-use {
  6 + text-align: center;
  7 + margin-top: 20px;
  8 +}
... ...
sass/style.scss
... ... @@ -11,6 +11,7 @@
11 11 @import 'slick';
12 12 @import 'slick-theme';
13 13 @import 'share';
  14 +@import 'article';
14 15  
15 16 @import 'proposal_detail/proposal-detail-base';
16 17 @import 'proposal_detail/urgencia-e-emergencia';
... ...