From 47add6da7091e5f7795fdb5d232fec870b6761cf Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 21 Aug 2013 12:03:21 -0400 Subject: [PATCH] Log when a site customization is deleted --- ...nge_site_customization_details_controller.js | 3 ++- ...ete_site_customization_details_controller.js | 15 +++++++++++++++ .../admin/models/staff_action_log.js | 2 +- ...ite_customization_change_modal.js.handlebars | 10 +++++++--- .../change_site_customization_details_view.js | 3 ++- .../delete_site_customization_details_view.js | 13 +++++++++++++ .../admin/site_customizations_controller.rb | 3 +-- app/models/staff_action_log.rb | 8 ++++++-- app/services/staff_action_logger.rb | 17 ++++++++++++++--- config/locales/client.en.yml | 2 ++ spec/services/staff_action_logger_spec.rb | 16 ++++++++++++++++ 11 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 app/assets/javascripts/admin/controllers/delete_site_customization_details_controller.js create mode 100644 app/assets/javascripts/admin/views/modals/delete_site_customization_details_view.js diff --git a/app/assets/javascripts/admin/controllers/change_site_customization_details_controller.js b/app/assets/javascripts/admin/controllers/change_site_customization_details_controller.js index 7fe0d014f08..121fb2a0032 100644 --- a/app/assets/javascripts/admin/controllers/change_site_customization_details_controller.js +++ b/app/assets/javascripts/admin/controllers/change_site_customization_details_controller.js @@ -1,5 +1,6 @@ /** - The modal for viewing the details of a staff action log record. + The modal for viewing the details of a staff action log record + for when a site customization is created or changed. @class ChangeSiteCustomizationDetailsController @extends Discourse.Controller diff --git a/app/assets/javascripts/admin/controllers/delete_site_customization_details_controller.js b/app/assets/javascripts/admin/controllers/delete_site_customization_details_controller.js new file mode 100644 index 00000000000..53a54c5054b --- /dev/null +++ b/app/assets/javascripts/admin/controllers/delete_site_customization_details_controller.js @@ -0,0 +1,15 @@ +/** + The modal for viewing the details of a staff action log record + for when a site customization is deleted. + + @class DeleteSiteCustomizationDetailsController + @extends Discourse.Controller + @namespace Discourse + @uses Discourse.ModalFunctionality + @module Discourse +**/ +Discourse.DeleteSiteCustomizationDetailsController = Discourse.ChangeSiteCustomizationDetailsController.extend({ + onShow: function() { + this.selectPrevious(); + } +}); diff --git a/app/assets/javascripts/admin/models/staff_action_log.js b/app/assets/javascripts/admin/models/staff_action_log.js index aa5a93ea6f4..93484194365 100644 --- a/app/assets/javascripts/admin/models/staff_action_log.js +++ b/app/assets/javascripts/admin/models/staff_action_log.js @@ -33,7 +33,7 @@ Discourse.StaffActionLog = Discourse.Model.extend({ }, useModalForDetails: function() { - return (this.get('action_name') === 'change_site_customization'); + return _.contains(['change_site_customization', 'delete_site_customization'], this.get('action_name')); }.property('action_name') }); diff --git a/app/assets/javascripts/admin/templates/logs/site_customization_change_modal.js.handlebars b/app/assets/javascripts/admin/templates/logs/site_customization_change_modal.js.handlebars index ca30597ed67..5d0e96ab3ab 100644 --- a/app/assets/javascripts/admin/templates/logs/site_customization_change_modal.js.handlebars +++ b/app/assets/javascripts/admin/templates/logs/site_customization_change_modal.js.handlebars @@ -9,9 +9,13 @@