From 09f6011bbd1821b381f1e8391b6ce93c1c4541a4 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 28 Oct 2014 14:56:11 +1100 Subject: [PATCH] PERF: split out category column rendering --- app/assets/javascripts/discourse/helpers/handlebars.js.es6 | 2 +- .../discourse/templates/list/category_column.raw.hbs | 3 +++ .../javascripts/discourse/templates/list/topic_list_item.hbs | 5 +---- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/discourse/templates/list/category_column.raw.hbs diff --git a/app/assets/javascripts/discourse/helpers/handlebars.js.es6 b/app/assets/javascripts/discourse/helpers/handlebars.js.es6 index 891b1ed9689..ce021cc2a50 100644 --- a/app/assets/javascripts/discourse/helpers/handlebars.js.es6 +++ b/app/assets/javascripts/discourse/helpers/handlebars.js.es6 @@ -5,7 +5,7 @@ Handlebars.registerHelper('handlebars', function(property, options) { if(params) { for(var prop in params){ - params[prop] = Em.Handlebars.get(this, params[prop]) || params[prop]; + params[prop] = Em.Handlebars.get(this, params[prop]); } } diff --git a/app/assets/javascripts/discourse/templates/list/category_column.raw.hbs b/app/assets/javascripts/discourse/templates/list/category_column.raw.hbs new file mode 100644 index 00000000000..5978e08b496 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/list/category_column.raw.hbs @@ -0,0 +1,3 @@ +{{#unless hideCategory}} +{{category-link "category" showParent=true}} +{{/unless}} 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 b1ac5e6c443..e78d8f23e18 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs @@ -27,10 +27,7 @@ {{/if}} -{{#unless hideCategory}} -{{bound-category-link category showParent=true}} -{{/unless}} - +{{handlebars 'list/category_column' hideCategory=hideCategory category=category}} {{handlebars 'list/posters_column' posters=posters}} {{posts-count-column topic=model class="num" action="showTopicEntrance"}}