mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FEATURE: remove override stylesheet option, too confusing
This commit is contained in:
parent
5d33dee817
commit
f23eb475a4
8 changed files with 11 additions and 19 deletions
|
@ -7,7 +7,7 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.SiteCustomization = Discourse.Model.extend({
|
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() {
|
description: function() {
|
||||||
return "" + this.name + (this.enabled ? ' (*)' : '');
|
return "" + this.name + (this.enabled ? ' (*)' : '');
|
||||||
|
@ -26,7 +26,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
||||||
|
|
||||||
return changed;
|
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() {
|
startTrackingChanges: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -51,8 +51,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
||||||
footer: this.footer,
|
footer: this.footer,
|
||||||
mobile_stylesheet: this.mobile_stylesheet,
|
mobile_stylesheet: this.mobile_stylesheet,
|
||||||
mobile_header: this.mobile_header,
|
mobile_header: this.mobile_header,
|
||||||
mobile_footer: this.mobile_footer,
|
mobile_footer: this.mobile_footer
|
||||||
override_default_style: this.override_default_style
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var siteCustomization = this;
|
var siteCustomization = this;
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class='status-actions'>
|
<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>
|
<span>{{i18n 'admin.customize.enabled'}} {{input type="checkbox" checked=selectedItem.enabled}}</span>
|
||||||
{{#unless selectedItem.changed}}
|
{{#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>
|
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n 'admin.customize.explain_preview'}}">{{i18n 'admin.customize.preview'}}</a>
|
||||||
|
|
|
@ -17,6 +17,3 @@
|
||||||
<section class="field">
|
<section class="field">
|
||||||
<b>{{i18n 'admin.customize.enabled'}}</b>: {{enabled}}
|
<b>{{i18n 'admin.customize.enabled'}}</b>: {{enabled}}
|
||||||
</section>
|
</section>
|
||||||
<section class="field">
|
|
||||||
<b>{{i18n 'admin.customize.override_default'}}</b>: {{override_default_style}}
|
|
||||||
</section>
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Admin::SiteCustomizationsController < Admin::AdminController
|
||||||
params.require(:site_customization)
|
params.require(:site_customization)
|
||||||
.permit(:name, :stylesheet, :header, :footer,
|
.permit(:name, :stylesheet, :header, :footer,
|
||||||
:mobile_stylesheet, :mobile_header, :mobile_footer,
|
:mobile_stylesheet, :mobile_header, :mobile_footer,
|
||||||
:position, :enabled, :key, :override_default_style,
|
:position, :enabled, :key,
|
||||||
:stylesheet_baked)
|
:stylesheet_baked)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,12 +100,6 @@ class SiteCustomization < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
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)
|
def self.lookup_style(key)
|
||||||
return if key.blank?
|
return if key.blank?
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ class StaffActionLogger
|
||||||
}))
|
}))
|
||||||
end
|
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={})
|
def log_site_customization_change(old_record, site_customization_params, opts={})
|
||||||
raise Discourse::InvalidParameters.new('site_customization_params is nil') unless site_customization_params
|
raise Discourse::InvalidParameters.new('site_customization_params is nil') unless site_customization_params
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
|
<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop) %>
|
||||||
<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop) %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<%- if staff? %>
|
<%- if staff? %>
|
||||||
<%= stylesheet_link_tag "admin"%>
|
<%= stylesheet_link_tag "admin"%>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RemoveOverrideDefaultStylesFromSiteCustomizations < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_column :site_customizations, :override_default_style
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue