diff --git a/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js b/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js index e47160c7446..7ae5c9064d4 100644 --- a/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_logs_staff_action_logs_controller.js @@ -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'), diff --git a/app/assets/javascripts/admin/controllers/admin_staff_action_log_details_controller.js b/app/assets/javascripts/admin/controllers/admin_staff_action_log_details_controller.js new file mode 100644 index 00000000000..887cde6a863 --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin_staff_action_log_details_controller.js @@ -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, {}); diff --git a/app/assets/javascripts/admin/models/staff_action_log.js b/app/assets/javascripts/admin/models/staff_action_log.js index 93484194365..aa92e841eb4 100644 --- a/app/assets/javascripts/admin/models/staff_action_log.js +++ b/app/assets/javascripts/admin/models/staff_action_log.js @@ -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') }); diff --git a/app/assets/javascripts/admin/routes/admin_logs_routes.js b/app/assets/javascripts/admin/routes/admin_logs_routes.js index 94bb150297f..cceb94b3f10 100644 --- a/app/assets/javascripts/admin/routes/admin_logs_routes.js +++ b/app/assets/javascripts/admin/routes/admin_logs_routes.js @@ -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'); } diff --git a/app/assets/javascripts/admin/templates/logs/details_modal.js.handlebars b/app/assets/javascripts/admin/templates/logs/details_modal.js.handlebars new file mode 100644 index 00000000000..73c62624ff2 --- /dev/null +++ b/app/assets/javascripts/admin/templates/logs/details_modal.js.handlebars @@ -0,0 +1,6 @@ +
{{details}}+