diff --git a/ember/app/components/discussions/discussion-listing.js b/ember/app/components/discussions/discussion-listing.js index 3ad275a6f..9f78325c4 100755 --- a/ember/app/components/discussions/discussion-listing.js +++ b/ember/app/components/discussions/discussion-listing.js @@ -25,6 +25,10 @@ export default Ember.Component.extend({ return this.get('countType') === 'unread' && this.get('discussion.isUnread'); }.property('countType', 'discussion.isUnread'), + countTitle: function() { + return this.get('discussion.isUnread') ? 'Mark as Read' : 'Jump to Last'; + }.property('discussion.isUnread'), + displayLastPost: function() { return this.get('terminalPostType') === 'last' && this.get('discussion.repliesCount'); }.property('terminalPostType', 'discussion.repliesCount'), @@ -56,10 +60,6 @@ export default Ember.Component.extend({ $this.animate({opacity: 1}, 'fast'); }, 100); - if (this.get('discussion.isUnread')) { - this.$().find('.count').tooltip({container: 'body'}); - } - // var view = this; // this.$().find('a.info').click(function() { @@ -148,6 +148,13 @@ export default Ember.Component.extend({ if ( ! this.get('controls.length')) { this.trigger('populateControls', this.get('controls')); } + }, + + markAsRead: function() { + if (this.get('discussion.isUnread')) { + window.event.stopPropagation(); + this.sendAction('markAsRead', this.get('discussion')); + } } } diff --git a/ember/app/styles/flarum/index.less b/ember/app/styles/flarum/index.less index 558a0f42f..d4a36822b 100644 --- a/ember/app/styles/flarum/index.less +++ b/ember/app/styles/flarum/index.less @@ -233,6 +233,8 @@ text-transform: uppercase; color: @fl-body-muted-color; font-size: 11px; + cursor: pointer; + text-decoration: none; & strong { font-size: 20px; @@ -242,7 +244,6 @@ .unread&, .unread& strong { color: @fl-body-heading-color; font-weight: bold; - cursor: pointer; } } } diff --git a/ember/app/templates/components/discussions/discussion-listing.hbs b/ember/app/templates/components/discussions/discussion-listing.hbs index dde753e26..d70db2b9f 100644 --- a/ember/app/templates/components/discussions/discussion-listing.hbs +++ b/ember/app/templates/components/discussions/discussion-listing.hbs @@ -26,13 +26,15 @@ {{/link-to}} -
- {{#if displayUnread}} - {{abbreviate-number discussion.unreadCount}} unread - {{else}} - {{abbreviate-number discussion.repliesCount}} replies - {{/if}} -
+{{#link-to "discussion" discussion.content (query-params start=discussion.lastPostNumber) current-when=null class="count" title=countTitle}} + + {{#if displayUnread}} + {{abbreviate-number discussion.unreadCount}} unread + {{else}} + {{abbreviate-number discussion.repliesCount}} replies + {{/if}} + +{{/link-to}} {{#if relevantPosts}}
diff --git a/ember/app/templates/index.hbs b/ember/app/templates/index.hbs index 1074812f8..1f15bdc70 100644 --- a/ember/app/templates/index.hbs +++ b/ember/app/templates/index.hbs @@ -30,7 +30,8 @@ discussion=discussion searchQuery=searchQuery terminalPostType=terminalPostType - countType=countType}} + countType=countType + markAsRead="markAsRead"}} {{/each}}