diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a65bda5e82..3ad0ece5e9b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -112,7 +112,7 @@ module ApplicationHelper end def login_path - return "#{Discourse::base_uri}/login" + "#{Discourse::base_uri}/login" end def mobile_view? @@ -128,4 +128,9 @@ module ApplicationHelper # TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming. request.user_agent =~ /Mobile|webOS|Nexus 7/ and !(request.user_agent =~ /iPad/) end + + def customization_disabled? + controller.class.name.split("::").first == "Admin" || session[:disable_customization] + end + end diff --git a/app/models/site_content.rb b/app/models/site_content.rb index a247b861bff..7bf6cef3be0 100644 --- a/app/models/site_content.rb +++ b/app/models/site_content.rb @@ -21,6 +21,7 @@ class SiteContent < ActiveRecord::Base add_content_type :privacy_policy, allow_blank: true add_content_type :faq, allow_blank: true + def site_content_type @site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym} end diff --git a/app/views/common/_discourse_stylesheet.html.erb b/app/views/common/_discourse_stylesheet.html.erb index 6c4d0df769c..41bff2413d1 100644 --- a/app/views/common/_discourse_stylesheet.html.erb +++ b/app/views/common/_discourse_stylesheet.html.erb @@ -10,6 +10,6 @@ <%= stylesheet_link_tag "admin"%> <%-end%> -<%- unless session[:disable_customization] %> +<%- unless customization_disabled? %> <%= SiteCustomization.custom_stylesheet(session[:preview_style], mobile_view? ? :mobile : :desktop) %> <%- end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c9379ec1663..0b3a0f7f798 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -31,7 +31,7 @@ - <%- unless session[:disable_customization] %> + <%- unless customization_disabled? %> <%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %> <%- end %> diff --git a/app/views/layouts/no_js.html.erb b/app/views/layouts/no_js.html.erb index 2bf11cb5b58..bd9da09fc1f 100644 --- a/app/views/layouts/no_js.html.erb +++ b/app/views/layouts/no_js.html.erb @@ -12,7 +12,7 @@ <%= discourse_csrf_tags %> - <%- unless session[:disable_customization] %> + <%- unless customization_disabled? %> <%= SiteCustomization.custom_header(session[:preview_style]) %> <%- end %>