FIX: only remove custom CSS in admin on first load

This commit is contained in:
Régis Hanol 2015-03-02 23:31:04 +01:00
parent 336c15672a
commit 1b2381d5a0
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,9 @@
export default Discourse.View.extend({
_disableCustomStylesheets: function() {
$("link.custom-css").attr("rel", "");
if (this.session.get("disableCustomCSS")) {
$("link.custom-css").attr("rel", "");
this.session.set("disableCustomCSS", false);
}
}.on("willInsertElement"),
_enableCustomStylesheets: function() {

View File

@ -153,11 +153,14 @@ module ApplicationHelper
MobileDetection.mobile_device?(request.user_agent)
end
def customization_disabled?
session[:disable_customization]
end
def loading_admin?
controller.class.name.split("::").first == "Admin"
end
def category_badge(category, opts=nil)
CategoryBadge.html_for(category, opts).html_safe
end

View File

@ -9,7 +9,6 @@
<script>
Ember.RSVP.configure('onerror', function(e) {
// Ignore TransitionAborted exceptions that bubble up
if (e && e.message === "TransitionAborted") { return; }
@ -43,6 +42,7 @@
Discourse.Route.mapRoutes();
Discourse.start();
Discourse.set('assetVersion','<%= Discourse.assets_digest %>');
Discourse.Session.currentProp("disableCustomCSS", <%= loading_admin? %>);
</script>
<%= script 'browser-update' %>