mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:03:44 +08:00
each ... in ... support for ember compat handlebars
This commit is contained in:
parent
95f9788a77
commit
da3da6feee
|
@ -38,7 +38,18 @@
|
|||
};
|
||||
};
|
||||
|
||||
stringCompatHelper("each");
|
||||
// #each .. in support
|
||||
RawHandlebars.registerHelper('each', function(localName,inKeyword,contextName,options){
|
||||
var list = Em.get(this, contextName);
|
||||
var output = [];
|
||||
var innerContext = Object.create(this);
|
||||
for (var i=0; i<list.length; i++) {
|
||||
innerContext[localName] = list[i];
|
||||
output.push(options.fn(innerContext));
|
||||
}
|
||||
return output.join('');
|
||||
});
|
||||
|
||||
stringCompatHelper("if");
|
||||
stringCompatHelper("unless");
|
||||
stringCompatHelper("with");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<td class='posters'>
|
||||
{{#each posters}}
|
||||
<a href="{{user.path}}" data-user-card="{{user.username}}" class="{{extras}}">{{avatar this usernamePath="user.username" imageSize="small"}}</a>
|
||||
{{#each poster in posters}}
|
||||
<a href="{{poster.user.path}}" data-user-card="{{poster.user.username}}" class="{{poster.extras}}">{{avatar poster usernamePath="user.username" imageSize="small"}}</a>
|
||||
{{/each}}
|
||||
</td>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{{~#if view.renderDiv ~}}
|
||||
<div class='topic-statuses'>
|
||||
{{/if ~}}
|
||||
{{~#each view.statuses ~}}
|
||||
<{{openTag}} title='{{title}}' class='topic-status'><i class='fa fa-{{icon}}'></i></{{closeTag}}>
|
||||
{{~#each status in view.statuses ~}}
|
||||
<{{status.openTag}} title='{{status.title}}' class='topic-status'><i class='fa fa-{{status.icon}}'></i></{{status.closeTag}}>
|
||||
{{~/each}}
|
||||
{{~#if view.renderDiv ~}}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user