From 0a78cdbd836a666502b09fea4cafc7df03b30b14 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 17 Sep 2015 11:38:21 -0400 Subject: [PATCH] FIX: Clicking users in Private Messages Map should show card --- .../discourse/components/d-button.js.es6 | 7 ++- .../discourse/components/topic-map.js.es6 | 11 +--- .../components/topic-participant.js.es6 | 4 +- .../discourse/components/who-liked.js.es6 | 2 + .../javascripts/discourse/lib/url.js.es6 | 2 +- .../components/private-message-map.hbs | 18 +++---- .../templates/components/topic-map.hbs | 54 +++++++++---------- .../components/topic-participant.hbs | 2 +- .../views/topic-map-container.js.es6 | 51 +++++++----------- 9 files changed, 68 insertions(+), 83 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6 index 068e814cae2..7737a995b27 100644 --- a/app/assets/javascripts/discourse/components/d-button.js.es6 +++ b/app/assets/javascripts/discourse/components/d-button.js.es6 @@ -1,5 +1,5 @@ import { iconHTML } from 'discourse/helpers/fa-icon'; -import computed from 'ember-addons/ember-computed-decorators'; +import { default as computed, observes } from 'ember-addons/ember-computed-decorators'; export default Ember.Component.extend({ tagName: 'button', @@ -18,6 +18,11 @@ export default Ember.Component.extend({ if (label) return I18n.t(label); }, + @observes('icon') + iconChanged() { + this.rerender(); + }, + render(buffer) { const label = this.get('translatedLabel'), icon = this.get('icon'); diff --git a/app/assets/javascripts/discourse/components/topic-map.js.es6 b/app/assets/javascripts/discourse/components/topic-map.js.es6 index eed1e182388..b09d1a2d8e2 100644 --- a/app/assets/javascripts/discourse/components/topic-map.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-map.js.es6 @@ -1,12 +1,3 @@ -/** - The topic map underneath the first post of a topic. - - @class TopicMapComponent - @extends Ember.Component - @namespace Discourse - @module Discourse -**/ - var LINKS_SHOWN = 5; export default Ember.Component.extend({ @@ -25,7 +16,7 @@ export default Ember.Component.extend({ showPosterAvatar: Em.computed.gt('topic.posts_count', 2), toggleMapClass: function() { - return this.get('mapCollapsed') ? 'fa fa-chevron-down' : 'fa fa-chevron-up'; + return this.get('mapCollapsed') ? 'chevron-down' : 'chevron-up'; }.property('mapCollapsed'), showAllLinksControls: function() { diff --git a/app/assets/javascripts/discourse/components/topic-participant.js.es6 b/app/assets/javascripts/discourse/components/topic-participant.js.es6 index 9db2b4b5145..e8e58ea34f2 100644 --- a/app/assets/javascripts/discourse/components/topic-participant.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-participant.js.es6 @@ -8,8 +8,8 @@ export default Ember.Component.extend({ }.property('postStream.userFilters.[]'), actions: { - toggle: function() { - var postStream = this.get('postStream'); + toggle() { + const postStream = this.get('postStream'); if (postStream) { postStream.toggleParticipant(this.get('participant.username')); } diff --git a/app/assets/javascripts/discourse/components/who-liked.js.es6 b/app/assets/javascripts/discourse/components/who-liked.js.es6 index 5c12a91d94b..901c948c55c 100644 --- a/app/assets/javascripts/discourse/components/who-liked.js.es6 +++ b/app/assets/javascripts/discourse/components/who-liked.js.es6 @@ -20,6 +20,8 @@ export default Ember.Component.extend(StringBuffer, { }); buffer.push(I18n.t('post.actions.people.like',{icons: iconsHtml})); buffer.push(""); + } else { + buffer.push(""); } } }); diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index ddc964cbad9..b3461163107 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -37,7 +37,7 @@ const DiscourseURL = Ember.Object.createWithMixins({ const lockon = new LockOn(holderId, {offsetCalculator: offset}); const holder = $(holderId); - if(holder.length > 0 && opts && opts.skipIfOnScreen){ + if (holder.length > 0 && opts && opts.skipIfOnScreen){ // if we are on screen skip const elementTop = lockon.elementTop(), diff --git a/app/assets/javascripts/discourse/templates/components/private-message-map.hbs b/app/assets/javascripts/discourse/templates/components/private-message-map.hbs index fa82b721e87..716f6078ee0 100644 --- a/app/assets/javascripts/discourse/templates/components/private-message-map.hbs +++ b/app/assets/javascripts/discourse/templates/components/private-message-map.hbs @@ -1,20 +1,20 @@ -

{{i18n 'private_message_info.title'}}

+

{{fa-icon "envelope"}} {{i18n 'private_message_info.title'}}

- {{#each ag in details.allowed_groups}} + {{#each details.allowed_groups as |ag|}}
#{{unbound ag.name}}
{{/each}} - {{#each au in details.allowed_users}} + {{#each details.allowed_users as |au|}}
- {{#link-to 'user' au}} + {{#user-link user=au}} {{avatar au imageSize="small"}} - {{/link-to}} - {{#link-to 'user' au}} + {{/user-link}} + {{#user-link user=au}} {{unbound au.username}} - {{/link-to}} - {{#if au.details.can_remove_allowed_users}} - + {{/user-link}} + {{#if details.can_remove_allowed_users}} + {{fa-icon "times"}} {{/if}}
{{/each}} diff --git a/app/assets/javascripts/discourse/templates/components/topic-map.hbs b/app/assets/javascripts/discourse/templates/components/topic-map.hbs index 915c3f0e711..05a1cbab34f 100644 --- a/app/assets/javascripts/discourse/templates/components/topic-map.hbs +++ b/app/assets/javascripts/discourse/templates/components/topic-map.hbs @@ -1,10 +1,8 @@ -
+