From de73e9fb564b367144aa5c10a040b43d0e804a94 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 12 Aug 2014 14:03:52 -0400 Subject: [PATCH] UX: Remove likes column, use heat map on posts count --- app/assets/javascripts/discourse/models/topic.js | 10 ++++++++++ .../components/basic-topic-list.js.handlebars | 10 +--------- .../discourse/templates/discovery/topics.js.handlebars | 3 --- .../templates/list/topic_list_item.js.handlebars | 8 +------- .../mobile/components/basic-topic-list.js.handlebars | 7 ------- .../mobile/list/topic_list_item.js.handlebars | 4 ---- 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/app/assets/javascripts/discourse/models/topic.js b/app/assets/javascripts/discourse/models/topic.js index edc4678ef7c..909b5c5f3ca 100644 --- a/app/assets/javascripts/discourse/models/topic.js +++ b/app/assets/javascripts/discourse/models/topic.js @@ -107,6 +107,16 @@ Discourse.Topic = Discourse.Model.extend({ return this.get('new_posts'); }.property('new_posts', 'id'), + likesHeat: function() { + var likes = parseFloat(this.get('like_count')), + posts = parseFloat(this.get('posts_count')), + ratio = (likes || 0) / (posts || 1); + + if (ratio > 2.0) { return 'heatmap-high'; } + if (ratio > 1.0) { return 'heatmap-med'; } + if (ratio > 0.5) { return 'heatmap-low'; } + }.property('like_count'), + viewsHeat: function() { var v = this.get('views'); if( v >= Discourse.SiteSettings.topic_views_heat_high ) return 'heatmap-high'; diff --git a/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars b/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars index df17869d173..c002ab2bb2f 100644 --- a/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars +++ b/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars @@ -10,8 +10,6 @@ {{i18n posts}} {{#if controller.showParticipants}} {{i18n users}} - {{else}} - {{i18n likes}} {{/if}} {{i18n views}} {{i18n activity}} @@ -41,7 +39,7 @@ {{/unless}} - + {{number topic.posts_count numberKey="posts_long"}} @@ -51,12 +49,6 @@ {{avatar this usernamePath="user.username" imageSize="small"}} {{/each}} - {{else}} - - {{#if topic.like_count}} - {{number topic.like_count}} - {{/if}} - {{/if}} diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars b/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars index 808baf01738..c932a1b4af9 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars @@ -51,9 +51,6 @@ {{#sortable-heading sortBy="posts" number=true action="changeSort" order=order ascending=ascending}} {{i18n posts}} {{/sortable-heading}} - {{#sortable-heading sortBy="likes" number=true action="changeSort" order=order ascending=ascending}} - {{i18n likes}} - {{/sortable-heading}} {{#sortable-heading sortBy="views" number=true action="changeSort" order=order ascending=ascending}} {{i18n views}} {{/sortable-heading}} diff --git a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars index 5cbeb908817..3560c5ffe33 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars @@ -46,13 +46,7 @@ {{/each}} -{{number posts_count numberKey="posts_long"}} - - - {{#if like_count}} - {{number like_count numberKey="likes_long"}} - {{/if}} - +{{number posts_count numberKey="posts_long"}} {{number views numberKey="views_long"}} diff --git a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.js.handlebars index 6b6fbd2cbdf..eb64533cdb1 100644 --- a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.js.handlebars @@ -33,13 +33,6 @@
{{number posts_count numberKey="posts_long"}}
- {{#if like_count}} -
- - {{number like_count numberKey="likes_long"}} - -
- {{/if}} {{#if bumped}}
{{age bumped_at}} diff --git a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars index a2f53c2992d..7b43e73ce3c 100644 --- a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars @@ -35,10 +35,6 @@