From ec7298d548b4a8bef12b2d1fe037e9f112ad730e Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 4 Nov 2013 15:48:51 -0500 Subject: [PATCH] FIX: Regression on topic list for best of links. --- .../discourse/helpers/grouped_each.js | 10 ++++-- .../list/basic_topic_list.js.handlebars | 36 +++++++++---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/grouped_each.js b/app/assets/javascripts/discourse/helpers/grouped_each.js index 218232aca..86c3ce13d 100644 --- a/app/assets/javascripts/discourse/helpers/grouped_each.js +++ b/app/assets/javascripts/discourse/helpers/grouped_each.js @@ -75,11 +75,17 @@ DiscourseGroupedEach.prototype = { var content = this.content, contentLength = Em.get(content, 'length'), data = this.options.data, - template = this.template; + template = this.template, + keyword = this.options.hash.keyword; data.insideEach = true; for (var i = 0; i < contentLength; i++) { - template(content.objectAt(i), { data: data }); + var row = content.objectAt(i); + if (keyword) { + data.keywords = data.keywords || {}; + data.keywords[keyword] = row; + } + template(row, { data: data }); } }, diff --git a/app/assets/javascripts/discourse/templates/list/basic_topic_list.js.handlebars b/app/assets/javascripts/discourse/templates/list/basic_topic_list.js.handlebars index 8c11a5226..7bab4e628 100644 --- a/app/assets/javascripts/discourse/templates/list/basic_topic_list.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/basic_topic_list.js.handlebars @@ -13,50 +13,50 @@ {{i18n activity}} - {{#each view.topics}} + {{#groupedEach topic in view.topics}} - {{topicStatus topic=this}} - {{{unbound fancy_title}}} + {{topicStatus topic=topic}} + {{{unbound topic.fancy_title}}} {{#if unread}} - {{unbound unread}} + {{unbound topic.unread}} {{/if}} - {{#if new_posts}} - {{unbound new_posts}} + {{#if topic.new_posts}} + {{unbound topic.new_posts}} {{/if}} - {{#if unseen}} - + {{#if topic.unseen}} + {{/if}} {{#unless controller.hideCategories}} - {{categoryLink category}} + {{categoryLink topic.category}} {{/unless}} - {{number posts_count numberKey="posts_long"}} + {{number topic.posts_count numberKey="posts_long"}} - {{#if like_count}} - {{unbound like_count}} + {{#if topic.like_count}} + {{unbound topic.like_count}} {{/if}} - {{number views numberKey="views_long"}} - {{#if bumped}} + {{number topic.views numberKey="views_long"}} + {{#if topic.bumped}} - {{unboundAge created_at}} + {{unboundAge topic.created_at}} - {{unboundAge bumped_at}} + {{unboundAge topic.bumped_at}} {{else}} - {{unboundAge created_at}} + {{unboundAge topic.created_at}} {{/if}} - {{/each}} + {{/groupedEach}} {{else}}