Commit 32a8c4dd596adcf006136acd9866cfd1192198bb

Authored by Victor Costa
1 parent 8459e1b6

Remove html tags from proposal abstract

Showing 2 changed files with 7 additions and 4 deletions   Show diff stats
@@ -279,7 +279,7 @@ @@ -279,7 +279,7 @@
279 279
280 <script id="support-proposal-template" type="text/x-handlebars-template"> 280 <script id="support-proposal-template" type="text/x-handlebars-template">
281 <div class="abstract"> 281 <div class="abstract">
282 - <p>{{trimString abstract 200}}</p> 282 + <p>{{stripTags (trimString abstract 200)}}</p>
283 </div> 283 </div>
284 <div class="vote-actions"> 284 <div class="vote-actions">
285 <a href="#" class="like dislike" data-vote-value="-1"></a> 285 <a href="#" class="like dislike" data-vote-value="-1"></a>
@@ -303,7 +303,7 @@ @@ -303,7 +303,7 @@
303 </tr> 303 </tr>
304 {{#each proposals}} 304 {{#each proposals}}
305 <tr> 305 <tr>
306 - <td class="abstract-text"><div class="truncate"><p class="truncated">{{abstract}}</p></div></td> 306 + <td class="abstract-text"><div class="truncate"><p class="truncated">{{stripTags abstract}}</p></div></td>
307 <td class="votes-for value">{{votes_for}}</td> 307 <td class="votes-for value">{{votes_for}}</td>
308 <td class="votes-against value">{{votes_against}}</td> 308 <td class="votes-against value">{{votes_against}}</td>
309 <td class="views value">{{hits}}</td> 309 <td class="views value">{{hits}}</td>
js/handlebars-helpers.js
@@ -75,8 +75,11 @@ define([&#39;handlebars&#39;], function(Handlebars){ @@ -75,8 +75,11 @@ define([&#39;handlebars&#39;], function(Handlebars){
75 }); 75 });
76 76
77 Handlebars.registerHelper('trimString', function(passedString, endstring) { 77 Handlebars.registerHelper('trimString', function(passedString, endstring) {
78 - var theString = passedString.substring(0, endstring);  
79 - return new Handlebars.SafeString(theString) 78 + return passedString.substring(0, endstring);
  79 + });
  80 +
  81 + Handlebars.registerHelper('stripTags', function(passedString) {
  82 + return $("<div/>").html(passedString).text();
80 }); 83 });
81 84
82 Handlebars.registerHelper('proposal_action', function(discussion, target) { 85 Handlebars.registerHelper('proposal_action', function(discussion, target) {