mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
add query parameter to temporarily disable customization
This commit is contained in:
parent
e25cf580d6
commit
e9f9d22482
7 changed files with 81 additions and 63 deletions
|
@ -8,6 +8,8 @@
|
|||
**/
|
||||
Discourse.AdminCustomizeController = Ember.ArrayController.extend({
|
||||
|
||||
actions: {
|
||||
|
||||
/**
|
||||
Create a new customization style
|
||||
|
||||
|
@ -56,4 +58,6 @@ Discourse.AdminCustomizeController = Ember.ArrayController.extend({
|
|||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class Admin::SiteCustomizationsController < Admin::AdminController
|
||||
|
||||
before_filter :enable_customization
|
||||
|
||||
def index
|
||||
@site_customizations = SiteCustomization.all
|
||||
|
||||
|
@ -56,4 +58,8 @@ class Admin::SiteCustomizationsController < Admin::AdminController
|
|||
StaffActionLogger.new(current_user).log_site_customization_change(old_record, new_params)
|
||||
end
|
||||
|
||||
def enable_customization
|
||||
session[:disable_customization] = false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,6 +27,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
before_filter :set_mobile_view
|
||||
before_filter :inject_preview_style
|
||||
before_filter :disable_customization
|
||||
before_filter :block_if_maintenance_mode
|
||||
before_filter :authorize_mini_profiler
|
||||
before_filter :store_incoming_links
|
||||
|
@ -36,8 +37,10 @@ class ApplicationController < ActionController::Base
|
|||
before_filter :redirect_to_login_if_required
|
||||
|
||||
rescue_from Exception do |exception|
|
||||
unless [ ActiveRecord::RecordNotFound, ActionController::RoutingError,
|
||||
ActionController::UnknownController, AbstractController::ActionNotFound].include? exception.class
|
||||
unless [ActiveRecord::RecordNotFound,
|
||||
ActionController::RoutingError,
|
||||
ActionController::UnknownController,
|
||||
AbstractController::ActionNotFound].include? exception.class
|
||||
begin
|
||||
ErrorLog.report_async!(exception, self, request, current_user)
|
||||
rescue
|
||||
|
@ -121,12 +124,15 @@ class ApplicationController < ActionController::Base
|
|||
session[:mobile_view] = params[:mobile_view] if params.has_key?(:mobile_view)
|
||||
end
|
||||
|
||||
|
||||
def inject_preview_style
|
||||
style = request['preview-style']
|
||||
session[:preview_style] = style if style
|
||||
end
|
||||
|
||||
def disable_customization
|
||||
session[:disable_customization] = params[:customization] == "0" if params.has_key?(:customization)
|
||||
end
|
||||
|
||||
def guardian
|
||||
@guardian ||= Guardian.new(current_user)
|
||||
end
|
||||
|
|
|
@ -22,9 +22,8 @@ class SiteCustomization < ActiveRecord::Base
|
|||
error.gsub!("'", '\27 ')
|
||||
|
||||
self.send("#{stylesheet_attr}_baked=",
|
||||
"#main {display: none;}
|
||||
footer {white-space: pre; margin-left: 100px;}
|
||||
footer:after{ content: '#{error}' }")
|
||||
"footer { white-space: pre; }
|
||||
footer:after { content: '#{error}' }")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,4 +10,6 @@
|
|||
<%= stylesheet_link_tag "admin"%>
|
||||
<%-end%>
|
||||
|
||||
<%= SiteCustomization.custom_stylesheet(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||
<%- unless session[:disable_customization] %>
|
||||
<%= SiteCustomization.custom_stylesheet(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||
<%- end %>
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
<body>
|
||||
<!--[if IE 9]><script type="text/javascript">ie = "new";</script><![endif]-->
|
||||
|
||||
<%- unless session[:disable_customization] %>
|
||||
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||
<%- end %>
|
||||
|
||||
<section id='main'>
|
||||
</section>
|
||||
|
||||
|
@ -57,6 +60,7 @@
|
|||
<footer id='bottom'></footer>
|
||||
|
||||
<%= render :partial => "common/discourse_javascript" %>
|
||||
|
||||
<%= render_google_analytics_code %>
|
||||
|
||||
<noscript data-path="<%= request.env['PATH_INFO'] %>">
|
||||
|
|
|
@ -7,16 +7,14 @@
|
|||
<meta content="" name="description">
|
||||
<meta content="" name="author">
|
||||
<link rel="icon" type="image/png" href=<%=SiteSetting.favicon_url%>>
|
||||
|
||||
<%= render :partial => "common/special_font_face" %>
|
||||
<%= render :partial => "common/discourse_stylesheet" %>
|
||||
|
||||
<%= discourse_csrf_tags %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<%=SiteCustomization.custom_header(session[:preview_style])%>
|
||||
<%- unless session[:disable_customization] %>
|
||||
<%= SiteCustomization.custom_header(session[:preview_style]) %>
|
||||
<%- end %>
|
||||
<section id='main'>
|
||||
<header class="d-header">
|
||||
<div class="container">
|
||||
|
@ -33,7 +31,6 @@
|
|||
<%= yield %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer id='bottom'>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue