do not customize the admin section

This commit is contained in:
Régis Hanol 2013-11-14 16:41:16 +01:00
parent 23deecfe44
commit 07cbf8f4e3
5 changed files with 10 additions and 4 deletions

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@
<body>
<!--[if IE 9]><script type="text/javascript">ie = "new";</script><![endif]-->
<%- unless session[:disable_customization] %>
<%- unless customization_disabled? %>
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
<%- end %>

View File

@ -12,7 +12,7 @@
<%= discourse_csrf_tags %>
</head>
<body>
<%- unless session[:disable_customization] %>
<%- unless customization_disabled? %>
<%= SiteCustomization.custom_header(session[:preview_style]) %>
<%- end %>
<section id='main'>