UX: Add staff notes to admin user profile
This commit is contained in:
parent
8d1cd35a52
commit
99ab454c74
|
@ -0,0 +1,4 @@
|
||||||
|
import connector from 'discourse/plugins/staff-notes/discourse-staff-notes/connectors/user-profile-controls/show-notes-on-profile';
|
||||||
|
|
||||||
|
// Same as other connector
|
||||||
|
export default connector;
|
|
@ -9,7 +9,10 @@ export default {
|
||||||
|
|
||||||
setupComponent(args, component) {
|
setupComponent(args, component) {
|
||||||
const { model } = args;
|
const { model } = args;
|
||||||
component.set('staffNotesCount', model.get('custom_fields.staff_notes_count') || 0);
|
component.set(
|
||||||
|
'staffNotesCount',
|
||||||
|
model.get('staff_notes_count') || model.get('custom_fields.staff_notes_count') || 0
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{{show-staff-notes show="showStaffNotes" count=staffNotesCount}}
|
|
@ -1,9 +1 @@
|
||||||
{{#if siteSettings.staff_notes_enabled}}
|
<li>{{show-staff-notes show="showStaffNotes" count=staffNotesCount}}</li>
|
||||||
{{#if currentUser.staff}}
|
|
||||||
{{#if staffNotesCount}}
|
|
||||||
<li><a {{action "showStaffNotes"}} href class="btn">{{fa-icon "pencil"}}{{i18n 'staff_notes.show' count=staffNotesCount}}</a></li>
|
|
||||||
{{else}}
|
|
||||||
<li><a {{action "showStaffNotes"}} href class="btn">{{fa-icon "pencil"}}{{i18n 'staff_notes.title'}}</a></li>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
tagName: '',
|
||||||
|
|
||||||
|
@computed('count')
|
||||||
|
showCount: count => count && count > 0,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
show() {
|
||||||
|
this.sendAction('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
<a {{action "show"}} href class="btn">
|
||||||
|
{{fa-icon "pencil"}}
|
||||||
|
{{#if showCount}}
|
||||||
|
{{i18n 'staff_notes.show' count=count}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n 'staff_notes.title'}}
|
||||||
|
{{/if}}
|
||||||
|
</a>
|
|
@ -142,6 +142,10 @@ after_initialize do
|
||||||
(SiteSetting.staff_notes_moderators_delete? && user.staff?) || user.admin?
|
(SiteSetting.staff_notes_moderators_delete? && user.staff?) || user.admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_to_serializer(:admin_detailed_user, :staff_notes_count, false) do
|
||||||
|
object.custom_fields && object.custom_fields['staff_notes_count'].to_i
|
||||||
|
end
|
||||||
|
|
||||||
DiscourseStaffNotes::Engine.routes.draw do
|
DiscourseStaffNotes::Engine.routes.draw do
|
||||||
get '/' => 'staff_notes#index'
|
get '/' => 'staff_notes#index'
|
||||||
post '/' => 'staff_notes#create'
|
post '/' => 'staff_notes#create'
|
||||||
|
|
Loading…
Reference in New Issue