Can use admin menu item to attach a note, too
This commit is contained in:
parent
bc9057073b
commit
9e040cabc9
|
@ -8,6 +8,15 @@ export default {
|
||||||
if (!siteSettings.staff_notes_enabled) { return; }
|
if (!siteSettings.staff_notes_enabled) { return; }
|
||||||
|
|
||||||
withPluginApi('0.2', api => {
|
withPluginApi('0.2', api => {
|
||||||
|
function showStaffNotes() {
|
||||||
|
const userId = this.attrs.user_id;
|
||||||
|
return this.store.find('staff-note', { user_id: userId }).then(model => {
|
||||||
|
const controller = showModal('staff-notes', { model, title: 'staff_notes.title' });
|
||||||
|
controller.reset();
|
||||||
|
controller.set('userId', userId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
api.decorateWidget('poster-name:after', dec => {
|
api.decorateWidget('poster-name:after', dec => {
|
||||||
const cfs = dec.attrs.userCustomFields || {};
|
const cfs = dec.attrs.userCustomFields || {};
|
||||||
if (cfs.has_staff_notes) {
|
if (cfs.has_staff_notes) {
|
||||||
|
@ -15,19 +24,22 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
api.decorateWidget('post-admin-menu:after', dec => {
|
||||||
|
return dec.attach('post-admin-menu-button', {
|
||||||
|
icon: 'pencil',
|
||||||
|
label: 'staff_notes.attach',
|
||||||
|
action: 'showStaffNotes'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
api.attachWidgetAction('post-admin-menu', 'showStaffNotes', showStaffNotes);
|
||||||
|
|
||||||
api.createWidget('staff-notes-icon', {
|
api.createWidget('staff-notes-icon', {
|
||||||
tagName: 'span.staff-notes-icon',
|
tagName: 'span.staff-notes-icon',
|
||||||
|
click: showStaffNotes,
|
||||||
|
|
||||||
html() {
|
html() {
|
||||||
return this.attach('emoji', { name: 'pencil' });
|
return this.attach('emoji', { name: 'pencil' });
|
||||||
},
|
|
||||||
|
|
||||||
click() {
|
|
||||||
return this.store.find('staff-note', { user_id: this.attrs.user_id }).then(model => {
|
|
||||||
const controller = showModal('staff-notes', { model, title: 'staff_notes.title' });
|
|
||||||
controller.reset();
|
|
||||||
controller.set('userId', this.attrs.user_id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,5 +2,5 @@ en:
|
||||||
js:
|
js:
|
||||||
staff_notes:
|
staff_notes:
|
||||||
title: "Staff Notes"
|
title: "Staff Notes"
|
||||||
attach: "Attach Note"
|
attach: "Attach Staff Note"
|
||||||
remove: "Remove Note"
|
remove: "Remove Note"
|
||||||
|
|
Loading…
Reference in New Issue