Fix: trigger group card on a post's primary group click
This commit is contained in:
parent
b87fa6d749
commit
99138b171a
|
@ -11,6 +11,7 @@ const clickOutsideEventName = "mousedown.outside-user-card";
|
||||||
const clickDataExpand = "click.discourse-user-card";
|
const clickDataExpand = "click.discourse-user-card";
|
||||||
const clickMention = "click.discourse-user-mention";
|
const clickMention = "click.discourse-user-mention";
|
||||||
const groupClickMention = "click.discourse-group-mention";
|
const groupClickMention = "click.discourse-group-mention";
|
||||||
|
const groupClickDataExpand = "click.discourse-group-card"
|
||||||
|
|
||||||
const maxMembersToDisplay = 10;
|
const maxMembersToDisplay = 10;
|
||||||
|
|
||||||
|
@ -162,6 +163,12 @@ export default Ember.Component.extend(CleansUp, {
|
||||||
return this._show($target.text().replace(/^@/, ''), $target, 'user');
|
return this._show($target.text().replace(/^@/, ''), $target, 'user');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#main-outlet').on(groupClickDataExpand, '[data-group-card]', (e) => {
|
||||||
|
if (wantsNewWindow(e)) { return; }
|
||||||
|
const $target = $(e.currentTarget);
|
||||||
|
return this._show($target.data('group-card'), $target, 'group');
|
||||||
|
});
|
||||||
|
|
||||||
$('#main-outlet').on(groupClickMention, 'a.mention-group', (e) => {
|
$('#main-outlet').on(groupClickMention, 'a.mention-group', (e) => {
|
||||||
if (wantsNewWindow(e)) { return; }
|
if (wantsNewWindow(e)) { return; }
|
||||||
const $target = $(e.target);
|
const $target = $(e.target);
|
||||||
|
@ -247,7 +254,7 @@ export default Ember.Component.extend(CleansUp, {
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super();
|
this._super();
|
||||||
$('html').off(clickOutsideEventName);
|
$('html').off(clickOutsideEventName);
|
||||||
$('#main').off(clickDataExpand).off(clickMention).off(groupClickMention);
|
$('#main').off(clickDataExpand).off(clickMention).off(groupClickMention).off(groupClickDataExpand);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -14,7 +14,7 @@ createWidget('poster-name-title', {
|
||||||
let titleContents = attrs.title;
|
let titleContents = attrs.title;
|
||||||
if (attrs.primaryGroupName) {
|
if (attrs.primaryGroupName) {
|
||||||
const href = Discourse.getURL(`/groups/${attrs.primaryGroupName}`);
|
const href = Discourse.getURL(`/groups/${attrs.primaryGroupName}`);
|
||||||
titleContents = h('a.user-group', { className: attrs.extraClasses, attributes: { href } }, attrs.title);
|
titleContents = h('a.user-group', { className: attrs.extraClasses, attributes: { href, 'data-group-card': attrs.primaryGroupName } }, attrs.title);
|
||||||
}
|
}
|
||||||
return titleContents;
|
return titleContents;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue