FEATURE: remove override stylesheet option, too confusing

This commit is contained in:
Sam 2014-12-22 16:18:32 +11:00
parent 5d33dee817
commit f23eb475a4
8 changed files with 11 additions and 19 deletions

View File

@ -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;

View File

@ -35,7 +35,6 @@
</div>
<br>
<div class='status-actions'>
<span>{{i18n 'admin.customize.override_default'}} {{input type="checkbox" checked=selectedItem.override_default_style}}</span>
<span>{{i18n 'admin.customize.enabled'}} {{input type="checkbox" checked=selectedItem.enabled}}</span>
{{#unless selectedItem.changed}}
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n 'admin.customize.explain_preview'}}">{{i18n 'admin.customize.preview'}}</a>

View File

@ -17,6 +17,3 @@
<section class="field">
<b>{{i18n 'admin.customize.enabled'}}</b>: {{enabled}}
</section>
<section class="field">
<b>{{i18n 'admin.customize.override_default'}}</b>: {{override_default_style}}
</section>

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -1,6 +1,4 @@
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop) %>
<%- end %>
<%- if staff? %>
<%= stylesheet_link_tag "admin"%>

View File

@ -0,0 +1,5 @@
class RemoveOverrideDefaultStylesFromSiteCustomizations < ActiveRecord::Migration
def change
remove_column :site_customizations, :override_default_style
end
end