Commit af49c91b7cb95182dc3881eeeedd49d0dbf9dbc8
1 parent
66b93e26
Exists in
master
and in
10 other branches
Truncate abstract string
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
index.html
| ... | ... | @@ -177,7 +177,7 @@ |
| 177 | 177 | </script> |
| 178 | 178 | |
| 179 | 179 | <script id='support-proposal-template' type='text/x-handlebars-template'> |
| 180 | - <div class='abstract'><p>"{{abstract}}"</p></div> | |
| 180 | + <div class='abstract'><p>"{{trimString abstract 200}}"</p></div> | |
| 181 | 181 | <div class="vote-actions"> |
| 182 | 182 | <a href="#" class="like dislike" data-vote-value="-1"></a> |
| 183 | 183 | <a href="#" class="like" data-vote-value="1"></a> | ... | ... |
js/handlebars-helpers.js
| ... | ... | @@ -68,6 +68,11 @@ Handlebars.registerHelper('select_proposal', function(proposals, category_slug, |
| 68 | 68 | return ret; |
| 69 | 69 | }); |
| 70 | 70 | |
| 71 | +Handlebars.registerHelper('trimString', function(passedString, endstring) { | |
| 72 | + var theString = passedString.substring(0, endstring); | |
| 73 | + return new Handlebars.SafeString(theString) | |
| 74 | +}); | |
| 75 | + | |
| 71 | 76 | function proposal_has_category(proposal, category_slug) { |
| 72 | 77 | for(var i=0; i<proposal.categories.length; i++) { |
| 73 | 78 | if(proposal.categories[i].slug == category_slug) | ... | ... |