Clicking on the date of a featured topic should show topic entrance

This commit is contained in:
Robin Ward 2015-02-24 12:56:06 -05:00
parent 7e2dd2463e
commit 5a7ae8c63f
4 changed files with 33 additions and 26 deletions

View File

@ -0,0 +1,11 @@
export default Ember.Component.extend({
classNameBindings: [':featured-topic'],
click(e) {
const $target = $(e.target);
if ($target.closest('.last-posted-at').length) {
this.sendAction('action', {topic: this.get('topic'), position: $target.offset()});
return false;
}
}
});

View File

@ -7,7 +7,8 @@ export default DiscoveryController.extend({
showPostsColumn: Em.computed.empty('withLogo'),
actions: {
refresh: function() {
refresh() {
// Don't refresh if we're still loading
if (this.get('controllers.discovery.loading')) { return; }
@ -17,15 +18,11 @@ export default DiscoveryController.extend({
// Lesson learned: Don't call `loading` yourself.
this.set('controllers.discovery.loading', true);
var parentCategory = this.get('model.parentCategory');
var promise;
if (parentCategory) {
promise = Discourse.CategoryList.listForParent(parentCategory);
} else {
promise = Discourse.CategoryList.list();
}
const parentCategory = this.get('model.parentCategory');
const promise = parentCategory ? Discourse.CategoryList.listForParent(parentCategory) :
Discourse.CategoryList.list();
var self = this;
const self = this;
promise.then(function(list) {
self.set('model', list);
self.send('loadingComplete');

View File

@ -0,0 +1,13 @@
{{topic-status topic=topic}}
<a class='title' href="{{unbound topic.lastUnreadUrl}}">{{{unbound topic.fancy_title}}}</a>
{{topic-post-badges newPosts=topic.totalUnread unseen=topic.unseen url=topic.lastUnreadUrl}}
{{#if latestTopicOnly}}
<div class='last-user-info'>
{{i18n 'categories.latest_by'}} <a href="{{{unbound topic.lastPosterUrl}}}">{{unbound topic.last_poster.username}}</a>
<a href="{{unbound topic.lastPostUrl}}">{{format-age topic.last_posted_at}}</a>
</div>
{{else}}
&nbsp;
<a href class="last-posted-at">{{format-age topic.last_posted_at}}</a>
{{/if}}

View File

@ -16,10 +16,10 @@
<div class="pull-left">
{{category-title-link category=c}}
{{#if c.unreadTopics}}
<a href={{unbound c.unreadUrl}} class='badge new-posts badge-notification' title='{{i18n 'topic.unread_topics' count=c.unreadTopics}}'>{{i18n 'filters.unread.lower_title_with_count' count=c.unreadTopics}}</a>
<a href="{{unbound c.unreadUrl}}" class='badge new-posts badge-notification' title='{{i18n 'topic.unread_topics' count=c.unreadTopics}}'>{{i18n 'filters.unread.lower_title_with_count' count=c.unreadTopics}}</a>
{{/if}}
{{#if c.newTopics}}
<a href={{unbound c.newUrl}} class='badge new-posts badge-notification' title='{{i18n 'topic.new_topics' count=c.newTopics}}'>{{i18n 'filters.new.lower_title_with_count' count=c.newTopics}}</a>
<a href="{{unbound c.newUrl}}" class='badge new-posts badge-notification' title='{{i18n 'topic.new_topics' count=c.newTopics}}'>{{i18n 'filters.new.lower_title_with_count' count=c.newTopics}}</a>
{{/if}}
</div>
<div class="clearfix"></div>
@ -45,21 +45,7 @@
</td>
<td {{bind-attr class="c.archived :latest"}}>
{{#each f in c.featuredTopics}}
<div class="featured-topic">
{{topic-status topic=f}}
<a class='title' href="{{unbound f.lastUnreadUrl}}">{{{unbound f.fancy_title}}}</a>
{{topic-post-badges newPosts=f.totalUnread unseen=f.unseen url=f.lastUnreadUrl}}
{{#if controller.latestTopicOnly}}
<div class='last-user-info'>
{{i18n 'categories.latest_by'}} <a href="{{{unbound f.lastPosterUrl}}}">{{unbound f.last_poster.username}}</a>
<a href="{{unbound f.lastPostUrl}}">{{format-age f.last_posted_at}}</a>
</div>
{{else}}
&nbsp;
<a href="{{unbound f.lastPostUrl}}" class="last-posted-at">{{format-age f.last_posted_at}}</a>
{{/if}}
</div>
{{featured-topic topic=f latestTopicOnly=latestTopicOnly action="showTopicEntrance"}}
{{/each}}
</td>
<td class='stats' {{bind-attr title="c.topicStatsTitle"}}>