diff --git a/app/assets/javascripts/discourse/helpers/handlebars.js.es6 b/app/assets/javascripts/discourse/helpers/handlebars.js.es6 new file mode 100644 index 00000000000..891b1ed9689 --- /dev/null +++ b/app/assets/javascripts/discourse/helpers/handlebars.js.es6 @@ -0,0 +1,17 @@ +Handlebars.registerHelper('handlebars', function(property, options) { + + var template = Em.TEMPLATES[property + ".raw"]; + var params = options.hash; + + if(params) { + for(var prop in params){ + params[prop] = Em.Handlebars.get(this, params[prop]) || params[prop]; + } + } + + return new Handlebars.SafeString(template(params)); +}); + +Handlebars.registerHelper('get', function(property) { + return Em.get(this, property); +}); diff --git a/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs b/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs index 6735b9b8c22..904c7779c48 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs @@ -31,7 +31,7 @@ {{bound-category-link category showParent=true}} {{/unless}} -{{view 'posters-column' posters=posters}} +{{handlebars 'posters_column' posters=posters}} {{posts-count-column topic=model class="num" action="showTopicEntrance"}} {{number views numberKey="views_long"}} diff --git a/app/assets/javascripts/discourse/templates/posters_column.raw.hbs b/app/assets/javascripts/discourse/templates/posters_column.raw.hbs new file mode 100644 index 00000000000..b091db1aac6 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/posters_column.raw.hbs @@ -0,0 +1,5 @@ + +{{#each posters}} +{{avatar this usernamePath="user.username" imageSize="small"}} +{{/each}} +