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