UX: Move topic entrance widget to posts column

This commit is contained in:
Robin Ward 2014-08-20 12:57:52 -04:00
parent 3fe6fc54d9
commit eb02619d1f
8 changed files with 33 additions and 32 deletions

View file

@ -37,22 +37,7 @@ export default Ember.Component.extend({
}.property('bumpedAt', 'createdAt'), }.property('bumpedAt', 'createdAt'),
render: function(buffer) { render: function(buffer) {
buffer.push("<a href>" + Discourse.Formatter.autoUpdatingRelativeAge(this.get('bumpedAt')) + "</a>"); buffer.push("<a href='" + this.get('topic.lastPostUrl') +"'>" + Discourse.Formatter.autoUpdatingRelativeAge(this.get('bumpedAt')) + "</a>");
},
click: function() {
var topic = this.get('topic');
if (Discourse.Mobile.mobileView) {
Discourse.URL.routeTo(topic.get('lastPostUrl'));
return false;
}
this.sendAction('action', {
topic: topic,
position: this.$('span').position()
});
return false;
} }
}); });

View file

@ -40,8 +40,8 @@ export default Ember.Component.extend({
}, },
actions: { actions: {
clickedActivity: function(data) { clickedPosts: function(data) {
this.sendAction('activityAction', data); this.sendAction('postsAction', data);
} }
} }

View file

@ -31,11 +31,27 @@ export default Ember.Component.extend({
likesHeat: Discourse.computed.fmt('ratioText', 'heatmap-%@'), likesHeat: Discourse.computed.fmt('ratioText', 'heatmap-%@'),
render: function(buffer) { render: function(buffer) {
var postsCount = this.get('topic.posts_count'), var postsCount = this.get('topic.posts_count');
url = this.get('topic.lastPostUrl');
buffer.push("<a href='" + url + "' class='badge-posts " + this.get('likesHeat') + "'>"); buffer.push("<a href class='badge-posts " + this.get('likesHeat') + "'>");
buffer.push(Discourse.Formatter.number(postsCount)); buffer.push(Discourse.Formatter.number(postsCount));
buffer.push("</a>"); buffer.push("</a>");
},
click: function() {
var topic = this.get('topic');
if (Discourse.Mobile.mobileView) {
Discourse.URL.routeTo(topic.get('lastPostUrl'));
return false;
}
this.sendAction('action', {
topic: topic,
position: this.$('a').position()
});
return false;
} }
}); });

View file

@ -39,7 +39,7 @@
</td> </td>
{{/unless}} {{/unless}}
{{posts-count-column topic=topic class="num"}} {{posts-count-column topic=topic class="num" action="clickedPosts"}}
{{#if controller.showParticipants}} {{#if controller.showParticipants}}
<td class='participants'> <td class='participants'>
@ -53,7 +53,7 @@
{{number topic.views numberKey="views_long"}} {{number topic.views numberKey="views_long"}}
</td> </td>
{{activity-column topic=topic class="num" action="clickedActivity"}} {{activity-column topic=topic class="num"}}
</tr> </tr>
{{/grouped-each}} {{/grouped-each}}
</tbody> </tbody>

View file

@ -5,28 +5,28 @@
{{#if content.yearly}} {{#if content.yearly}}
<div class="clearfix"> <div class="clearfix">
<h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_year}}</h2> <h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_year}}</h2>
{{basic-topic-list topicList=content.yearly hideCategory=hideCategory activityAction="showTopicEntrance"}} {{basic-topic-list topicList=content.yearly hideCategory=hideCategory postsAction="showTopicEntrance"}}
{{#if content.yearly.topics.length}}<a href="{{unbound showMoreYearlyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}} {{#if content.yearly.topics.length}}<a href="{{unbound showMoreYearlyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}}
</div> </div>
{{/if}} {{/if}}
{{#if content.monthly}} {{#if content.monthly}}
<div class="clearfix"> <div class="clearfix">
<h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_month}}</h2> <h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_month}}</h2>
{{basic-topic-list topicList=content.monthly hideCategory=hideCategory activityAction="showTopicEntrance"}} {{basic-topic-list topicList=content.monthly hideCategory=hideCategory postsAction="showTopicEntrance"}}
{{#if content.monthly.topics.length}}<a href="{{unbound showMoreMonthlyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}} {{#if content.monthly.topics.length}}<a href="{{unbound showMoreMonthlyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}}
</div> </div>
{{/if}} {{/if}}
{{#if content.weekly}} {{#if content.weekly}}
<div class="clearfix"> <div class="clearfix">
<h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_week}}</h2> <h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.this_week}}</h2>
{{basic-topic-list topicList=content.weekly hideCategory=hideCategory activityAction="showTopicEntrance"}} {{basic-topic-list topicList=content.weekly hideCategory=hideCategory postsAction="showTopicEntrance"}}
{{#if content.weekly.topics.length}}<a href="{{unbound showMoreWeeklyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}} {{#if content.weekly.topics.length}}<a href="{{unbound showMoreWeeklyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}}
</div> </div>
{{/if}} {{/if}}
{{#if content.daily}} {{#if content.daily}}
<div class="clearfix"> <div class="clearfix">
<h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.today}}</h2> <h2><i class="fa fa-calendar-o"></i> {{i18n filters.top.today}}</h2>
{{basic-topic-list topicList=content.daily hideCategory=hideCategory activityAction="showTopicEntrance"}} {{basic-topic-list topicList=content.daily hideCategory=hideCategory postsAction="showTopicEntrance"}}
{{#if content.daily.topics.length}}<a href="{{unbound showMoreDailyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}} {{#if content.daily.topics.length}}<a href="{{unbound showMoreDailyUrl}}" class='btn btn-default pull-right'>{{i18n show_more}}</a>{{/if}}
</div> </div>
{{/if}} {{/if}}

View file

@ -42,7 +42,7 @@
{{view 'posters-column' posters=posters}} {{view 'posters-column' posters=posters}}
{{posts-count-column topic=model class="num"}} {{posts-count-column topic=model class="num" action="showTopicEntrance"}}
<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>
{{activity-column topic=model class="num" action="showTopicEntrance"}} {{activity-column topic=model class="num"}}

View file

@ -1,4 +1,4 @@
{{basic-topic-list topicList=model {{basic-topic-list topicList=model
hideCategory=hideCategory hideCategory=hideCategory
showParticipants=showParticipants showParticipants=showParticipants
activityAction="showTopicEntrance"}} postsAction="showTopicEntrance"}}

View file

@ -102,7 +102,7 @@
<div id='suggested-topics'> <div id='suggested-topics'>
<h3>{{i18n suggested_topics.title}}</h3> <h3>{{i18n suggested_topics.title}}</h3>
<div class='topics'> <div class='topics'>
{{basic-topic-list topics=details.suggested_topics activityAction="showTopicEntrance"}} {{basic-topic-list topics=details.suggested_topics postsAction="showTopicEntrance"}}
</div> </div>
<h3>{{{view.browseMoreMessage}}}</h3> <h3>{{{view.browseMoreMessage}}}</h3>
</div> </div>