diff --git a/app/assets/javascripts/discourse/components/poster-avatar.js.es6 b/app/assets/javascripts/discourse/components/poster-avatar.js.es6 new file mode 100644 index 00000000000..9b55540d072 --- /dev/null +++ b/app/assets/javascripts/discourse/components/poster-avatar.js.es6 @@ -0,0 +1,17 @@ +export default Ember.Component.extend({ + tagName: 'a', + attributeBindings: ['href'], + classNames: ['trigger-expansion'], + href: Em.computed.alias('post.usernameUrl'), + + click: function(e) { + this.appEvents.trigger('poster:expand', $(e.target)); + this.sendAction('action', this.get('post')); + return false; + }, + + render: function(buffer) { + var avatar = Handlebars.helpers.avatar(this.get('post'), {hash: {imageSize: 'large'}}); + buffer.push(avatar); + } +}); diff --git a/app/assets/javascripts/discourse/components/poster-name.js.es6 b/app/assets/javascripts/discourse/components/poster-name.js.es6 index 90d53295504..284376d3ba0 100644 --- a/app/assets/javascripts/discourse/components/poster-name.js.es6 +++ b/app/assets/javascripts/discourse/components/poster-name.js.es6 @@ -1,5 +1,5 @@ var PosterNameComponent = Em.Component.extend({ - classNames: ['names'], + classNames: ['names', 'trigger-expansion'], displayNameOnPosts: Discourse.computed.setting('display_name_on_posts'), // sanitize name for comparison @@ -67,6 +67,7 @@ var PosterNameComponent = Em.Component.extend({ if (!Em.isEmpty(href) && href !== '#') { return true; } else { + this.appEvents.trigger('poster:expand', $target); this.sendAction('expandAction', this.get('post')); } return false; diff --git a/app/assets/javascripts/discourse/controllers/poster-expansion.js.es6 b/app/assets/javascripts/discourse/controllers/poster-expansion.js.es6 index ae4092dae0b..a0ec468b1ae 100644 --- a/app/assets/javascripts/discourse/controllers/poster-expansion.js.es6 +++ b/app/assets/javascripts/discourse/controllers/poster-expansion.js.es6 @@ -1,11 +1,3 @@ -/** - A controller for expanding information about a poster. - - @class PosterExpansion - @extends Discourse.ObjectController - @namespace Discourse - @module Discourse -**/ export default Discourse.ObjectController.extend({ needs: ['topic'], visible: false, diff --git a/app/assets/javascripts/discourse/initializers/inject-app-events.js.es6 b/app/assets/javascripts/discourse/initializers/inject-app-events.js.es6 index 7be3a087755..6a11fd729d6 100644 --- a/app/assets/javascripts/discourse/initializers/inject-app-events.js.es6 +++ b/app/assets/javascripts/discourse/initializers/inject-app-events.js.es6 @@ -5,6 +5,7 @@ export default { application.register('app-events:main', AppEvents, { singleton: true }); application.inject('controller', 'appEvents', 'app-events:main'); + application.inject('component', 'appEvents', 'app-events:main'); application.inject('route', 'appEvents', 'app-events:main'); application.inject('view', 'appEvents', 'app-events:main'); application.inject('model', 'appEvents', 'app-events:main'); diff --git a/app/assets/javascripts/discourse/templates/embedded_post.js.handlebars b/app/assets/javascripts/discourse/templates/embedded_post.js.handlebars index 1358c9a65dc..a2007af2106 100644 --- a/app/assets/javascripts/discourse/templates/embedded_post.js.handlebars +++ b/app/assets/javascripts/discourse/templates/embedded_post.js.handlebars @@ -2,13 +2,13 @@