Skip to content

Commit 07cbf8f

Browse files
committed
do not customize the admin section
1 parent 23deecf commit 07cbf8f

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def markdown_content(key, replacements=nil)
112112
end
113113

114114
def login_path
115-
return "#{Discourse::base_uri}/login"
115+
"#{Discourse::base_uri}/login"
116116
end
117117

118118
def mobile_view?
@@ -128,4 +128,9 @@ def mobile_device?
128128
# TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming.
129129
request.user_agent =~ /Mobile|webOS|Nexus 7/ and !(request.user_agent =~ /iPad/)
130130
end
131+
132+
def customization_disabled?
133+
controller.class.name.split("::").first == "Admin" || session[:disable_customization]
134+
end
135+
131136
end

app/models/site_content.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def self.formats
2121
add_content_type :privacy_policy, allow_blank: true
2222
add_content_type :faq, allow_blank: true
2323

24+
2425
def site_content_type
2526
@site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym}
2627
end

app/views/common/_discourse_stylesheet.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<%= stylesheet_link_tag "admin"%>
1111
<%-end%>
1212

13-
<%- unless session[:disable_customization] %>
13+
<%- unless customization_disabled? %>
1414
<%= SiteCustomization.custom_stylesheet(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
1515
<%- end %>

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<body>
3232
<!--[if IE 9]><script type="text/javascript">ie = "new";</script><![endif]-->
3333

34-
<%- unless session[:disable_customization] %>
34+
<%- unless customization_disabled? %>
3535
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
3636
<%- end %>
3737

app/views/layouts/no_js.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<%= discourse_csrf_tags %>
1313
</head>
1414
<body>
15-
<%- unless session[:disable_customization] %>
15+
<%- unless customization_disabled? %>
1616
<%= SiteCustomization.custom_header(session[:preview_style]) %>
1717
<%- end %>
1818
<section id='main'>

0 commit comments

Comments
 (0)