mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:04:21 +08:00
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 clickMention = "click.discourse-user-mention";
|
||||
const groupClickMention = "click.discourse-group-mention";
|
||||
const groupClickDataExpand = "click.discourse-group-card"
|
||||
|
||||
const maxMembersToDisplay = 10;
|
||||
|
||||
|
@ -162,6 +163,12 @@ export default Ember.Component.extend(CleansUp, {
|
|||
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) => {
|
||||
if (wantsNewWindow(e)) { return; }
|
||||
const $target = $(e.target);
|
||||
|
@ -247,7 +254,7 @@ export default Ember.Component.extend(CleansUp, {
|
|||
willDestroyElement() {
|
||||
this._super();
|
||||
$('html').off(clickOutsideEventName);
|
||||
$('#main').off(clickDataExpand).off(clickMention).off(groupClickMention);
|
||||
$('#main').off(clickDataExpand).off(clickMention).off(groupClickMention).off(groupClickDataExpand);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -14,7 +14,7 @@ createWidget('poster-name-title', {
|
|||
let titleContents = attrs.title;
|
||||
if (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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user