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'),
render: function(buffer) {
buffer.push("<a href>" + 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;
buffer.push("<a href='" + this.get('topic.lastPostUrl') +"'>" + Discourse.Formatter.autoUpdatingRelativeAge(this.get('bumpedAt')) + "</a>");
}
});

View file

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

View file

@ -31,11 +31,27 @@ export default Ember.Component.extend({
likesHeat: Discourse.computed.fmt('ratioText', 'heatmap-%@'),
render: function(buffer) {
var postsCount = this.get('topic.posts_count'),
url = this.get('topic.lastPostUrl');
var postsCount = this.get('topic.posts_count');
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("</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>
{{/unless}}
{{posts-count-column topic=topic class="num"}}
{{posts-count-column topic=topic class="num" action="clickedPosts"}}
{{#if controller.showParticipants}}
<td class='participants'>
@ -53,7 +53,7 @@
{{number topic.views numberKey="views_long"}}
</td>
{{activity-column topic=topic class="num" action="clickedActivity"}}
{{activity-column topic=topic class="num"}}
</tr>
{{/grouped-each}}
</tbody>

View file

@ -5,28 +5,28 @@
{{#if content.yearly}}
<div class="clearfix">
<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}}
</div>
{{/if}}
{{#if content.monthly}}
<div class="clearfix">
<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}}
</div>
{{/if}}
{{#if content.weekly}}
<div class="clearfix">
<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}}
</div>
{{/if}}
{{#if content.daily}}
<div class="clearfix">
<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}}
</div>
{{/if}}

View file

@ -42,7 +42,7 @@
{{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>
{{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
hideCategory=hideCategory
showParticipants=showParticipants
activityAction="showTopicEntrance"}}
postsAction="showTopicEntrance"}}

View file

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