From f23eb475a4c3400caa3dc5e1e2723bda42e4bb47 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 22 Dec 2014 16:18:32 +1100 Subject: [PATCH] FEATURE: remove override stylesheet option, too confusing --- app/assets/javascripts/admin/models/site_customization.js | 7 +++---- .../javascripts/admin/templates/customize_css_html.hbs | 1 - .../templates/logs/_site_customization_change_details.hbs | 3 --- app/controllers/admin/site_customizations_controller.rb | 2 +- app/models/site_customization.rb | 6 ------ app/services/staff_action_logger.rb | 2 +- app/views/common/_discourse_stylesheet.html.erb | 4 +--- ...ove_override_default_styles_from_site_customizations.rb | 5 +++++ 8 files changed, 11 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20141222051622_remove_override_default_styles_from_site_customizations.rb diff --git a/app/assets/javascripts/admin/models/site_customization.js b/app/assets/javascripts/admin/models/site_customization.js index 0e678185ccf..bc41b493615 100644 --- a/app/assets/javascripts/admin/models/site_customization.js +++ b/app/assets/javascripts/admin/models/site_customization.js @@ -7,7 +7,7 @@ @module Discourse **/ Discourse.SiteCustomization = Discourse.Model.extend({ - trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'override_default_style'], + trackedProperties: ['enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer'], description: function() { return "" + this.name + (this.enabled ? ' (*)' : ''); @@ -26,7 +26,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({ return changed; - }.property('override_default_style', 'enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'originals'), + }.property('enabled', 'name', 'stylesheet', 'header', 'footer', 'mobile_stylesheet', 'mobile_header', 'mobile_footer', 'originals'), startTrackingChanges: function() { var self = this; @@ -51,8 +51,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({ footer: this.footer, mobile_stylesheet: this.mobile_stylesheet, mobile_header: this.mobile_header, - mobile_footer: this.mobile_footer, - override_default_style: this.override_default_style + mobile_footer: this.mobile_footer }; var siteCustomization = this; diff --git a/app/assets/javascripts/admin/templates/customize_css_html.hbs b/app/assets/javascripts/admin/templates/customize_css_html.hbs index 6bf7f0d5338..3729955d74e 100644 --- a/app/assets/javascripts/admin/templates/customize_css_html.hbs +++ b/app/assets/javascripts/admin/templates/customize_css_html.hbs @@ -35,7 +35,6 @@
- {{i18n 'admin.customize.override_default'}} {{input type="checkbox" checked=selectedItem.override_default_style}} {{i18n 'admin.customize.enabled'}} {{input type="checkbox" checked=selectedItem.enabled}} {{#unless selectedItem.changed}} {{i18n 'admin.customize.preview'}} diff --git a/app/assets/javascripts/admin/templates/logs/_site_customization_change_details.hbs b/app/assets/javascripts/admin/templates/logs/_site_customization_change_details.hbs index eced3892f91..1c353f62ad3 100644 --- a/app/assets/javascripts/admin/templates/logs/_site_customization_change_details.hbs +++ b/app/assets/javascripts/admin/templates/logs/_site_customization_change_details.hbs @@ -17,6 +17,3 @@
{{i18n 'admin.customize.enabled'}}: {{enabled}}
-
- {{i18n 'admin.customize.override_default'}}: {{override_default_style}} -
diff --git a/app/controllers/admin/site_customizations_controller.rb b/app/controllers/admin/site_customizations_controller.rb index 16540daaf27..4c3f671da6e 100644 --- a/app/controllers/admin/site_customizations_controller.rb +++ b/app/controllers/admin/site_customizations_controller.rb @@ -54,7 +54,7 @@ class Admin::SiteCustomizationsController < Admin::AdminController params.require(:site_customization) .permit(:name, :stylesheet, :header, :footer, :mobile_stylesheet, :mobile_header, :mobile_footer, - :position, :enabled, :key, :override_default_style, + :position, :enabled, :key, :stylesheet_baked) end diff --git a/app/models/site_customization.rb b/app/models/site_customization.rb index 47d224b6e89..43f7752fc1d 100644 --- a/app/models/site_customization.rb +++ b/app/models/site_customization.rb @@ -100,12 +100,6 @@ class SiteCustomization < ActiveRecord::Base end end - def self.override_default_style(preview_style) - preview_style ||= enabled_style_key - style = lookup_style(preview_style) - style.override_default_style if style - end - def self.lookup_style(key) return if key.blank? diff --git a/app/services/staff_action_logger.rb b/app/services/staff_action_logger.rb index 9dbe38e17c2..0c9e6c115ca 100644 --- a/app/services/staff_action_logger.rb +++ b/app/services/staff_action_logger.rb @@ -79,7 +79,7 @@ class StaffActionLogger })) end - SITE_CUSTOMIZATION_LOGGED_ATTRS = ['stylesheet', 'header', 'position', 'enabled', 'key', 'override_default_style'] + SITE_CUSTOMIZATION_LOGGED_ATTRS = ['stylesheet', 'header', 'position', 'enabled', 'key'] def log_site_customization_change(old_record, site_customization_params, opts={}) raise Discourse::InvalidParameters.new('site_customization_params is nil') unless site_customization_params diff --git a/app/views/common/_discourse_stylesheet.html.erb b/app/views/common/_discourse_stylesheet.html.erb index a249e1b458b..3d1f10818bc 100644 --- a/app/views/common/_discourse_stylesheet.html.erb +++ b/app/views/common/_discourse_stylesheet.html.erb @@ -1,6 +1,4 @@ -<%- unless SiteCustomization.override_default_style(session[:preview_style]) %> - <%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop) %> -<%- end %> +<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop) %> <%- if staff? %> <%= stylesheet_link_tag "admin"%> diff --git a/db/migrate/20141222051622_remove_override_default_styles_from_site_customizations.rb b/db/migrate/20141222051622_remove_override_default_styles_from_site_customizations.rb new file mode 100644 index 00000000000..c70f570f863 --- /dev/null +++ b/db/migrate/20141222051622_remove_override_default_styles_from_site_customizations.rb @@ -0,0 +1,5 @@ +class RemoveOverrideDefaultStylesFromSiteCustomizations < ActiveRecord::Migration + def change + remove_column :site_customizations, :override_default_style + end +end