PERF: move excerpt to raw, expose i18n to handlebars

This commit is contained in:
Sam 2014-10-29 16:08:35 +11:00
parent 403271d2db
commit eab12cc6b8
4 changed files with 12 additions and 15 deletions

View File

@ -23,7 +23,7 @@ I18n.toHumanSize = function(number, options) {
@method i18n
@for Handlebars
**/
Ember.Handlebars.registerHelper('i18n', function(property, options) {
Handlebars.registerHelper('i18n', function(property, options) {
// Resolve any properties
var params = options.hash,
self = this;

View File

@ -60,11 +60,7 @@
var id = new Handlebars.AST.IdNode([{ part: 'get' }]);
if (!mustache.escaped) {
mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]);
}
mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);
mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, mustache.escaped);
}
return Handlebars.Compiler.prototype.mustache.call(this, mustache);

View File

@ -0,0 +1,8 @@
{{#if topic.hasExcerpt}}
<div class="topic-excerpt">
{{{topic.excerpt}}}
{{#if topic.excerptTruncated}}
<a href="{{topic.url}}">{{i18n read_more}}</a>
{{/if}}
</div>
{{/if}}

View File

@ -10,21 +10,14 @@
{{/if}}
{{/if}}
<td class='main-link clearfix' {{bind-attr colspan="titleColSpan"}}>
<td class='main-link clearfix' colspan="{{unbound titleColSpan}}">
{{topic-status topic=this.model}}
{{topic-link this}}
{{#if showTopicPostBadges}}
{{topic-post-badges unread=unread newPosts=displayNewPosts unseen=unseen url=lastUnreadUrl}}
{{/if}}
{{#if hasExcerpt}}
<div class="topic-excerpt">
{{{excerpt}}}
{{#if excerptTruncated}}
<a href="{{url}}">{{i18n read_more}}</a>
{{/if}}
</div>
{{/if}}
{{raw "list/topic_excerpt" topic=model}}
</td>
{{raw "list/category_column" hideCategory=hideCategory category=category}}