";
ret = ret + "" + proposals[i].title + "
";
ret = ret + "" + proposals[i].body + " ";
ret = ret + '';
}
return ret;
});
Handlebars.registerHelper('replace', function(string, to_replace, replacement) {
return (string || '').replace(new RegExp(to_replace, 'g'), replacement);
});
Handlebars.registerHelper('select_proposal', function(proposals, category_slug, selected_id) {
var ret = 'Selecione o programa '
ret = ret + '';
for(var i=0; i'+proposals[i].title+'';
}
ret += ' ';
return ret;
});
Handlebars.registerHelper('trimString', function(passedString, endstring) {
return passedString.substring(0, endstring);
});
Handlebars.registerHelper('stripTags', function(passedString) {
return $("
").html(passedString).text();
});
Handlebars.registerHelper('proposal_action', function(discussion, target) {
if(discussion.setting && discussion.setting.moderate_proposals) {
return '/api/v1/articles/'+target.id+'/children/suggest';
} else {
return '/api/v1/articles/'+target.id+'/children';
}
});
Handlebars.registerHelper('round', function(num) {
return +(Math.round(num + "e+2") + "e-2");
});
Handlebars.registerHelper('social_share', function(title, description, url) {
var template = Handlebars.compile($('#social-share').html());
if(url==='#') {
url = '';
}
url = 'http:'+Url.addBaseUrl(url);
return template({title: title, description: description, url: url});
});
Handlebars.registerHelper('proposal_url', function(parent_id, id) {
return "#/programas/"+parent_id+"/propostas/"+id;
});
Handlebars.registerHelper('program_detail_url', function(id) {
return "#/programas/"+id+"/sobre-o-programa";
});
Handlebars.registerHelper('encodeURI', function(uri) {
return encodeURIComponent(uri);
});
function proposal_has_category(proposal, category_slug) {
for(var i=0; i