mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Show staff action log details in a modal
This commit is contained in:
parent
47add6da70
commit
e5464a4bed
7 changed files with 41 additions and 12 deletions
|
@ -20,10 +20,6 @@ Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Disc
|
|||
});
|
||||
}.observes('filters.action_name', 'filters.staff_user', 'filters.target_user', 'filters.subject'),
|
||||
|
||||
toggleFullDetails: function(target) {
|
||||
target.set('showFullDetails', !target.get('showFullDetails'));
|
||||
},
|
||||
|
||||
filtersExists: function() {
|
||||
return (_.size(this.get('filters')) > 0);
|
||||
}.property('filters.action_name', 'filters.staff_user', 'filters.target_user', 'filters.subject'),
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
The modal for viewing the details of a staff action log record.
|
||||
|
||||
@class AdminStaffActionLogDetailsController
|
||||
@extends Discourse.Controller
|
||||
@namespace Discourse
|
||||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminStaffActionLogDetailsController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {});
|
|
@ -17,7 +17,7 @@ Discourse.StaffActionLog = Discourse.Model.extend({
|
|||
var formatted = "";
|
||||
formatted += this.format('email', 'email');
|
||||
formatted += this.format('admin.logs.staff_actions.ip_address', 'ip_address');
|
||||
if (!this.get('useModalForDetails')) {
|
||||
if (!this.get('useCustomModalForDetails')) {
|
||||
formatted += this.format('admin.logs.staff_actions.new_value', 'new_value');
|
||||
formatted += this.format('admin.logs.staff_actions.previous_value', 'previous_value');
|
||||
}
|
||||
|
@ -33,6 +33,10 @@ Discourse.StaffActionLog = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
useModalForDetails: function() {
|
||||
return (this.get('details') && this.get('details').length > 0);
|
||||
}.property('action_name'),
|
||||
|
||||
useCustomModalForDetails: function() {
|
||||
return _.contains(['change_site_customization', 'delete_site_customization'], this.get('action_name'));
|
||||
}.property('action_name')
|
||||
});
|
||||
|
|
|
@ -35,6 +35,11 @@ Discourse.AdminLogsStaffActionLogsRoute = Discourse.Route.extend({
|
|||
|
||||
events: {
|
||||
showDetailsModal: function(logRecord) {
|
||||
Discourse.Route.showModal(this, 'admin_staff_action_log_details', logRecord);
|
||||
this.controllerFor('modal').set('modalClass', 'log-details-modal');
|
||||
},
|
||||
|
||||
showCustomDetailsModal: function(logRecord) {
|
||||
Discourse.Route.showModal(this, logRecord.action_name + '_details', logRecord);
|
||||
this.controllerFor('modal').set('modalClass', 'tabbed-modal log-details-modal');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<div class="modal-body">
|
||||
<pre>{{details}}</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class='btn btn-primary' {{action closeModal}}>{{i18n close}}</button>
|
||||
</div>
|
|
@ -17,15 +17,11 @@
|
|||
<div class="col value created_at">{{unboundAgeWithTooltip created_at}}</div>
|
||||
<div class="col value details">
|
||||
{{{formattedDetails}}}
|
||||
{{#if useCustomModalForDetails}}
|
||||
<a {{action showCustomDetailsModal this}}>{{i18n admin.logs.staff_actions.show}}</a>
|
||||
{{/if}}
|
||||
{{#if useModalForDetails}}
|
||||
<a {{action showDetailsModal this}}>{{i18n admin.logs.staff_actions.show}}</a>
|
||||
{{else}}
|
||||
{{#if showFullDetails}}
|
||||
<a {{action toggleFullDetails this}}>{{i18n less}}</a><br/>
|
||||
{{details}}
|
||||
{{else}}
|
||||
<a {{action toggleFullDetails this}}>{{i18n more}}</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="col value context">{{context}}</div>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
A modal view for details of a staff action log record in a modal.
|
||||
|
||||
@class AdminStaffActionLogDetailsView
|
||||
@extends Discourse.ModalBodyView
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminStaffActionLogDetailsView = Discourse.ModalBodyView.extend({
|
||||
templateName: 'admin/templates/logs/details_modal',
|
||||
title: I18n.t('admin.logs.staff_actions.modal_title')
|
||||
});
|
Loading…
Reference in a new issue