Commit 1b308937e4e9e7ccd7760a2d4bc0b08e9c672bdc

Authored by Victor Costa
1 parent 4c468653

Add position to ranking

Showing 2 changed files with 6 additions and 2 deletions   Show diff stats
index.html
... ... @@ -326,19 +326,19 @@
326 326 </div>
327 327 <table>
328 328 <tr class="header">
  329 + <td class="position">Posição</td>
329 330 <td class="abstract-text">Propostas</td>
330 331 <td class="votes-for"></td>
331 332 <td class="votes-against"></td>
332 333 <td class="views">Exibições</td>
333   - <td class="support">Apoio</td>
334 334 </tr>
335 335 {{#each proposals}}
336 336 <tr>
  337 + <td class="">{{calcPosition @index ../pagination.per_page ../pagination.page}}</td>
337 338 <td class="abstract-text"><div class="truncate"><p class="truncated">{{stripTags abstract}}</p></div></td>
338 339 <td class="votes-for value">{{votes_for}}</td>
339 340 <td class="votes-against value">{{votes_against}}</td>
340 341 <td class="views value">{{hits}}</td>
341   - <td class="support value">{{#round effective_support}}{{/round}}</td>
342 342 </tr>
343 343 {{/each}}
344 344 </table>
... ...
js/handlebars-helpers.js
... ... @@ -115,6 +115,10 @@ define([&#39;handlebars&#39;], function(Handlebars){
115 115 return encodeURIComponent(uri);
116 116 });
117 117  
  118 + Handlebars.registerHelper('calcPosition', function(index, per_page, page) {
  119 + return index + 1 + per_page * (page - 1);
  120 + });
  121 +
118 122 function proposal_has_category(proposal, category_slug) {
119 123 for(var i=0; i<proposal.categories.length; i++) {
120 124 if(proposal.categories[i].slug == category_slug)
... ...