UX: Remove likes column, use heat map on posts count

This commit is contained in:
Robin Ward 2014-08-12 14:03:52 -04:00
parent e49ef042f1
commit de73e9fb56
6 changed files with 12 additions and 30 deletions

View File

@ -107,6 +107,16 @@ Discourse.Topic = Discourse.Model.extend({
return this.get('new_posts'); return this.get('new_posts');
}.property('new_posts', 'id'), }.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() { viewsHeat: function() {
var v = this.get('views'); var v = this.get('views');
if( v >= Discourse.SiteSettings.topic_views_heat_high ) return 'heatmap-high'; if( v >= Discourse.SiteSettings.topic_views_heat_high ) return 'heatmap-high';

View File

@ -10,8 +10,6 @@
<th class="num posts">{{i18n posts}}</th> <th class="num posts">{{i18n posts}}</th>
{{#if controller.showParticipants}} {{#if controller.showParticipants}}
<th class="posters">{{i18n users}}</th> <th class="posters">{{i18n users}}</th>
{{else}}
<th class="num likes">{{i18n likes}}</th>
{{/if}} {{/if}}
<th class="num views">{{i18n views}}</th> <th class="num views">{{i18n views}}</th>
<th class="num activity" colspan="2">{{i18n activity}}</th> <th class="num activity" colspan="2">{{i18n activity}}</th>
@ -41,7 +39,7 @@
</td> </td>
{{/unless}} {{/unless}}
<td class='num posts'> <td {{bind-attr class=":num :posts likesHeat"}}>
<a href="{{unbound topic.lastUnreadUrl}}" class='badge-posts'>{{number topic.posts_count numberKey="posts_long"}}</a> <a href="{{unbound topic.lastUnreadUrl}}" class='badge-posts'>{{number topic.posts_count numberKey="posts_long"}}</a>
</td> </td>
@ -51,12 +49,6 @@
<a href="{{user.path}}" class="{{extras}}">{{avatar this usernamePath="user.username" imageSize="small"}}</a> <a href="{{user.path}}" class="{{extras}}">{{avatar this usernamePath="user.username" imageSize="small"}}</a>
{{/each}} {{/each}}
</td> </td>
{{else}}
<td class='num likes'>
{{#if topic.like_count}}
<a href='{{unbound topic.url}}'>{{number topic.like_count}} <i class='fa fa-heart'></i></a>
{{/if}}
</td>
{{/if}} {{/if}}
<td {{bind-attr class=":num :views topic.viewsHeat"}}> <td {{bind-attr class=":num :views topic.viewsHeat"}}>

View File

@ -51,9 +51,6 @@
{{#sortable-heading sortBy="posts" number=true action="changeSort" order=order ascending=ascending}} {{#sortable-heading sortBy="posts" number=true action="changeSort" order=order ascending=ascending}}
{{i18n posts}} {{i18n posts}}
{{/sortable-heading}} {{/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}} {{#sortable-heading sortBy="views" number=true action="changeSort" order=order ascending=ascending}}
{{i18n views}} {{i18n views}}
{{/sortable-heading}} {{/sortable-heading}}

View File

@ -46,13 +46,7 @@
{{/each}} {{/each}}
</td> </td>
<td class='num posts'><a href="{{lastUnreadUrl}}" class='badge-posts'>{{number posts_count numberKey="posts_long"}}</a></td> <td {{bind-attr class=":num :posts likesHeat"}}><a href="{{lastUnreadUrl}}" class='badge-posts'>{{number posts_count numberKey="posts_long"}}</a></td>
<td class='num likes'>
{{#if like_count}}
<a href='{{url}}' title='{{i18n topic.likes count="like_count"}}'>{{number like_count numberKey="likes_long"}} <i class='fa fa-heart'></i></a>
{{/if}}
</td>
<td {{bind-attr class=":num :views viewsHeat"}}>{{number views numberKey="views_long"}}</td> <td {{bind-attr class=":num :views viewsHeat"}}>{{number views numberKey="views_long"}}</td>

View File

@ -33,13 +33,6 @@
<div class='num posts'> <div class='num posts'>
<a href="{{lastUnreadUrl}}">{{number posts_count numberKey="posts_long"}}</a> <a href="{{lastUnreadUrl}}">{{number posts_count numberKey="posts_long"}}</a>
</div> </div>
{{#if like_count}}
<div class='num likes'>
<a href='{{url}}' title='{{i18n topic.likes count="like_count"}}'>
<i class='fa fa-heart'></i> {{number like_count numberKey="likes_long"}}
</a>
</div>
{{/if}}
{{#if bumped}} {{#if bumped}}
<div class='num activity last'> <div class='num activity last'>
<a href="{{lastPostUrl}}" class='age' title='{{i18n last_post}}: {{{raw-date bumped_at}}}'>{{age bumped_at}}</a> <a href="{{lastPostUrl}}" class='age' title='{{i18n last_post}}: {{{raw-date bumped_at}}}'>{{age bumped_at}}</a>

View File

@ -35,10 +35,6 @@
<div class="pull-right"> <div class="pull-right">
<div class='num posts'><a href="{{lastUnreadUrl}}">{{number posts_count numberKey="posts_long"}}</a></div> <div class='num posts'><a href="{{lastUnreadUrl}}">{{number posts_count numberKey="posts_long"}}</a></div>
{{#if like_count}}
<div class='num likes'><a href='{{url}}' title='{{i18n topic.likes count="like_count"}}'>{{number like_count numberKey="likes_long"}} <i class='fa fa-heart'></i></a></div>
{{/if}}
{{#if bumped}} {{#if bumped}}
<div class='num activity last'> <div class='num activity last'>
<a href="{{lastPostUrl}}" title='{{i18n last_post}}: {{{raw-date bumped_at}}}'>{{last_poster_username}}</a> <a href="{{lastPostUrl}}" title='{{i18n last_post}}: {{{raw-date bumped_at}}}'>{{last_poster_username}}</a>