UX: Display staff notes popup instead of redirecting to user page

This commit is contained in:
Vinoth Kannan 2019-03-20 08:07:28 +05:30
parent 52338dd6eb
commit b5cb662802
2 changed files with 15 additions and 2 deletions

View File

@ -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"; import { emojiUrlFor } from "discourse/lib/text";
export default { export default {
@ -17,5 +19,16 @@ export default {
component.set("emojiUrl", emojiUrlFor("pencil")); component.set("emojiUrl", emojiUrlFor("pencil"));
component.set("user", user); component.set("user", user);
component.set("staffNotesTitle", I18n.t("staff_notes.show", { count })); 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)
);
}
} }
}; };

View File

@ -1,9 +1,9 @@
{{#if staffNotesCount}} {{#if staffNotesCount}}
{{#link-to "user" user title=staffNotesTitle}} <a href {{action "showStaffNotes"}} title="{{staffNotesTitle}}">
{{#if emojiEnabled}} {{#if emojiEnabled}}
<img src={{emojiUrl}} title={{staffNotesTitle}} alt="pencil" class="emoji"> <img src={{emojiUrl}} title={{staffNotesTitle}} alt="pencil" class="emoji">
{{else}} {{else}}
{{d-icon "sticky-note"}} {{d-icon "sticky-note"}}
{{/if}} {{/if}}
{{/link-to}} </a>
{{/if}} {{/if}}