diff --git a/framework/core/ember/app/components/index/discussion-listing.js b/framework/core/ember/app/components/index/discussion-listing.js index cf960ffd4..cead2aa49 100755 --- a/framework/core/ember/app/components/index/discussion-listing.js +++ b/framework/core/ember/app/components/index/discussion-listing.js @@ -2,6 +2,7 @@ import Ember from 'ember'; import HasItemLists from 'flarum/mixins/has-item-lists'; import FadeIn from 'flarum/mixins/fade-in'; +import humanTime from 'flarum/utils/human-time'; /** Component for a discussion listing on the discussions index. It has `info` @@ -38,10 +39,14 @@ export default Ember.Component.extend(FadeIn, HasItemLists, { return this.get('terminalPostType') === 'last' && this.get('discussion.repliesCount'); }), - start: Ember.computed('discussion.lastPostNumber', 'discussion.readNumber', function() { + jumpTo: Ember.computed('discussion.lastPostNumber', 'discussion.readNumber', function() { return Math.min(this.get('discussion.lastPostNumber'), (this.get('discussion.readNumber') || 0) + 1); }), + authorInfo: Ember.computed('discussion.startUser.username', 'discussion.startTime', function() { + return (this.get('discussion.startUser.username') || '[deleted]')+' started '+humanTime(this.get('discussion.startTime')); + }), + relevantPosts: Ember.computed('discussion.relevantPosts', 'discussion.startPost', 'discussion.lastPost', function() { if (this.get('controller.show') !== 'posts') { return []; } if (this.get('controller.searchQuery')) { @@ -53,6 +58,10 @@ export default Ember.Component.extend(FadeIn, HasItemLists, { } }), + didInsertElement: function() { + this.$('.author').tooltip({ placement: 'right' }); + }, + populateControls: function(items) { this.addActionItem(items, 'delete', 'Delete', 'times', 'discussion.canDelete'); }, diff --git a/framework/core/ember/app/helpers/user-avatar.js b/framework/core/ember/app/helpers/user-avatar.js index 257952c2b..b65af43ee 100644 --- a/framework/core/ember/app/helpers/user-avatar.js +++ b/framework/core/ember/app/helpers/user-avatar.js @@ -6,7 +6,11 @@ export default Ember.Handlebars.makeBoundHelper(function(user, options) { if (user) { var username = user.get('username') || '?'; - attributes += ' title="'+Ember.Handlebars.Utils.escapeExpression(username)+'"'; + + if (typeof options.hash.title === 'undefined') { + options.hash.title = Ember.Handlebars.Utils.escapeExpression(username); + } + attributes += ' title="'+options.hash.title+'"'; var avatarUrl = user.get('avatarUrl'); if (avatarUrl) { diff --git a/framework/core/ember/app/templates/components/index/discussion-listing.hbs b/framework/core/ember/app/templates/components/index/discussion-listing.hbs index 2f7fd9060..5fc13f377 100644 --- a/framework/core/ember/app/templates/components/index/discussion-listing.hbs +++ b/framework/core/ember/app/templates/components/index/discussion-listing.hbs @@ -7,11 +7,11 @@ menuClass="pull-right"}} {{/if}} -{{#link-to "user" discussion.startUser class="author"}}{{user-avatar discussion.startUser}}{{/link-to}} +{{#link-to "user" discussion.startUser class="author" title=authorInfo}}{{user-avatar discussion.startUser title=""}}{{/link-to}} {{ui/item-list items=discussion.badges class="badges"}} -{{#link-to "discussion" discussion (query-params start=start) current-when="discussion" class="main"}} +{{#link-to "discussion" discussion (query-params start=jumpTo) current-when="discussion" class="main"}}