From 44ff357e1c8523b1e27dcc8865c34a3993b20e71 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 29 Oct 2014 10:39:06 -0400 Subject: [PATCH] Remove unused view, use preferred dash format for filenames, add warnings when templates are missing --- app/assets/javascripts/discourse/helpers/raw.js.es6 | 10 ++++++++-- .../templates/components/basic-topic-list.hbs | 4 ++-- ...activity_column.raw.hbs => activity-column.raw.hbs} | 0 ...category_column.raw.hbs => category-column.raw.hbs} | 0 .../{posters_column.raw.hbs => posters-column.raw.hbs} | 0 .../{topic_excerpt.raw.hbs => topic-excerpt.raw.hbs} | 0 .../discourse/templates/list/topic_list_item.hbs | 8 ++++---- .../templates/mobile/components/basic-topic-list.hbs | 2 +- .../templates/mobile/list/topic_list_item.hbs | 2 +- .../javascripts/discourse/views/posters-column.js.es6 | 6 ------ 10 files changed, 16 insertions(+), 16 deletions(-) rename app/assets/javascripts/discourse/templates/list/{activity_column.raw.hbs => activity-column.raw.hbs} (100%) rename app/assets/javascripts/discourse/templates/list/{category_column.raw.hbs => category-column.raw.hbs} (100%) rename app/assets/javascripts/discourse/templates/list/{posters_column.raw.hbs => posters-column.raw.hbs} (100%) rename app/assets/javascripts/discourse/templates/list/{topic_excerpt.raw.hbs => topic-excerpt.raw.hbs} (100%) delete mode 100644 app/assets/javascripts/discourse/views/posters-column.js.es6 diff --git a/app/assets/javascripts/discourse/helpers/raw.js.es6 b/app/assets/javascripts/discourse/helpers/raw.js.es6 index 6e8e8657d49..0c1354369a7 100644 --- a/app/assets/javascripts/discourse/helpers/raw.js.es6 +++ b/app/assets/javascripts/discourse/helpers/raw.js.es6 @@ -1,11 +1,17 @@ Handlebars.registerHelper('raw', function(property, options) { - var template = Discourse.__container__.lookup('template:' + property + ".raw"), + var templateName = property + ".raw", + template = Discourse.__container__.lookup('template:' + templateName), params = options.hash; + if (!template) { + Ember.warn('Could not find raw template: ' + templateName); + return; + } + if (params) { for (var prop in params) { if (options.hashTypes[prop] === "ID") { - params[prop] = Em.Handlebars.get(this, params[prop], options); + params[prop] = Ember.Handlebars.get(this, params[prop], options); } } } diff --git a/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs b/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs index 39301934cf8..02d90715ae8 100644 --- a/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs @@ -28,7 +28,7 @@ url=topic.lastUnreadUrl}} - {{raw "list/category_column" hideCategory=controller.hideCategory category=topic.category}} + {{raw "list/category-column" hideCategory=controller.hideCategory category=topic.category}} {{posts-count-column topic=topic class="num" action="clickedPosts"}} @@ -44,7 +44,7 @@ {{number topic.views numberKey="views_long"}} - {{raw "list/activity_column" topic=topic class="num" tagName="td"}} + {{raw "list/activity-column" topic=topic class="num" tagName="td"}} {{/grouped-each}} diff --git a/app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs b/app/assets/javascripts/discourse/templates/list/activity-column.raw.hbs similarity index 100% rename from app/assets/javascripts/discourse/templates/list/activity_column.raw.hbs rename to app/assets/javascripts/discourse/templates/list/activity-column.raw.hbs diff --git a/app/assets/javascripts/discourse/templates/list/category_column.raw.hbs b/app/assets/javascripts/discourse/templates/list/category-column.raw.hbs similarity index 100% rename from app/assets/javascripts/discourse/templates/list/category_column.raw.hbs rename to app/assets/javascripts/discourse/templates/list/category-column.raw.hbs diff --git a/app/assets/javascripts/discourse/templates/list/posters_column.raw.hbs b/app/assets/javascripts/discourse/templates/list/posters-column.raw.hbs similarity index 100% rename from app/assets/javascripts/discourse/templates/list/posters_column.raw.hbs rename to app/assets/javascripts/discourse/templates/list/posters-column.raw.hbs diff --git a/app/assets/javascripts/discourse/templates/list/topic_excerpt.raw.hbs b/app/assets/javascripts/discourse/templates/list/topic-excerpt.raw.hbs similarity index 100% rename from app/assets/javascripts/discourse/templates/list/topic_excerpt.raw.hbs rename to app/assets/javascripts/discourse/templates/list/topic-excerpt.raw.hbs 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 62f7df23787..439f226e1cb 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.hbs @@ -17,13 +17,13 @@ {{topic-post-badges unread=unread newPosts=displayNewPosts unseen=unseen url=lastUnreadUrl}} {{/if}} - {{raw "list/topic_excerpt" topic=model}} + {{raw "list/topic-excerpt" topic=model}} -{{raw "list/category_column" hideCategory=hideCategory category=category}} -{{raw "list/posters_column" posters=posters}} +{{raw "list/category-column" hideCategory=hideCategory category=category}} +{{raw "list/posters-column" posters=posters}} {{posts-count-column topic=model class="num" action="showTopicEntrance"}} {{number views numberKey="views_long"}} -{{raw "list/activity_column" topic=model class="num" tagName="td"}} +{{raw "list/activity-column" topic=model class="num" tagName="td"}} diff --git a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs index 57098274d18..e24b34855b9 100644 --- a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs @@ -27,7 +27,7 @@
{{posts-count-column topic=topic tagName="div" class="num posts" action="clickedPosts"}} - {{raw "list/activity_column" topic=topic tagName="div" class="num activity last"}} + {{raw "list/activity-column" topic=topic tagName="div" class="num activity last"}}
{{#unless controller.hideCategory}}
diff --git a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.hbs b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.hbs index 1d7908ccf39..cbcbec96947 100644 --- a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.hbs @@ -31,7 +31,7 @@ {{posts-count-column topic=this tagName="div" class="num posts" action="showTopicEntrance"}}
{{last_poster_username}} - {{raw "list/activity_column" topic=this tagName="span" class="age"}} + {{raw "list/activity-column" topic=this tagName="span" class="age"}}
diff --git a/app/assets/javascripts/discourse/views/posters-column.js.es6 b/app/assets/javascripts/discourse/views/posters-column.js.es6 deleted file mode 100644 index af351a265f6..00000000000 --- a/app/assets/javascripts/discourse/views/posters-column.js.es6 +++ /dev/null @@ -1,6 +0,0 @@ -export default Ember.CollectionView.extend({ - classNames: ['posters'], - tagName: 'td', - content: Em.computed.alias('posters'), - itemViewClass: 'topic-list-poster' -});