From b5cb662802226fbe18ab60eb0c32e61c4add261e Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Wed, 20 Mar 2019 08:07:28 +0530 Subject: [PATCH] UX: Display staff notes popup instead of redirecting to user page --- .../show-staff-notes-on-card.js.es6 | 13 +++++++++++++ .../show-staff-notes-on-card.hbs | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse-staff-notes/connectors/user-card-post-names/show-staff-notes-on-card.js.es6 b/assets/javascripts/discourse-staff-notes/connectors/user-card-post-names/show-staff-notes-on-card.js.es6 index a43df2b..04d1498 100644 --- a/assets/javascripts/discourse-staff-notes/connectors/user-card-post-names/show-staff-notes-on-card.js.es6 +++ b/assets/javascripts/discourse-staff-notes/connectors/user-card-post-names/show-staff-notes-on-card.js.es6 @@ -1,3 +1,5 @@ +import { showStaffNotes } from "discourse/plugins/discourse-staff-notes/discourse-staff-notes/lib/staff-notes"; +import { getOwner } from "discourse-common/lib/get-owner"; import { emojiUrlFor } from "discourse/lib/text"; export default { @@ -17,5 +19,16 @@ export default { component.set("emojiUrl", emojiUrlFor("pencil")); component.set("user", user); component.set("staffNotesTitle", I18n.t("staff_notes.show", { count })); + }, + + actions: { + showStaffNotes() { + this.parentView.parentView._close(); + const store = getOwner(this).lookup("store:main"); + const user = this.get("args.user"); + showStaffNotes(store, user.get("id"), count => + this.set("staffNotesCount", count) + ); + } } }; diff --git a/assets/javascripts/discourse-staff-notes/templates/connectors/user-card-post-names/show-staff-notes-on-card.hbs b/assets/javascripts/discourse-staff-notes/templates/connectors/user-card-post-names/show-staff-notes-on-card.hbs index daa8634..3243569 100644 --- a/assets/javascripts/discourse-staff-notes/templates/connectors/user-card-post-names/show-staff-notes-on-card.hbs +++ b/assets/javascripts/discourse-staff-notes/templates/connectors/user-card-post-names/show-staff-notes-on-card.hbs @@ -1,9 +1,9 @@ {{#if staffNotesCount}} - {{#link-to "user" user title=staffNotesTitle}} + {{#if emojiEnabled}} pencil {{else}} {{d-icon "sticky-note"}} {{/if}} - {{/link-to}} + {{/if}}