From cd423f4a43031cdad838bd15e49fdec2d120216f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 20 Feb 2015 18:21:19 +0100 Subject: [PATCH] use the view instead --- app/assets/javascripts/admin/routes/admin_route.js | 10 ---------- app/assets/javascripts/admin/views/admin.js.es6 | 11 +++++++---- app/helpers/application_helper.rb | 2 +- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/admin/routes/admin_route.js b/app/assets/javascripts/admin/routes/admin_route.js index dc0c74da147..07fc597f039 100644 --- a/app/assets/javascripts/admin/routes/admin_route.js +++ b/app/assets/javascripts/admin/routes/admin_route.js @@ -1,15 +1,5 @@ Discourse.AdminRoute = Discourse.Route.extend({ titleToken: function() { return I18n.t('admin_title'); - }, - - activate: function() { - this._super(); - $("link.custom-css").attr("rel", ""); - }, - - deactivate: function() { - this._super(); - $("link.custom-css").attr("rel", "stylesheet"); } }); diff --git a/app/assets/javascripts/admin/views/admin.js.es6 b/app/assets/javascripts/admin/views/admin.js.es6 index cd0d05107e5..5336e272a0d 100644 --- a/app/assets/javascripts/admin/views/admin.js.es6 +++ b/app/assets/javascripts/admin/views/admin.js.es6 @@ -1,6 +1,9 @@ -export default Ember.View.extend({ - _onInsert: function() { +export default Discourse.View.extend({ + _disableCustomStylesheets: function() { + $("link.custom-css").attr("rel", ""); + }.on("willInsertElement"), - }.on('didInsertElement') + _enableCustomStylesheets: function() { + $("link.custom-css").attr("rel", "stylesheet"); + }.on("willDestroyElement") }); - diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9bf4db32db8..598c9f4f5e0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -151,7 +151,7 @@ module ApplicationHelper def customization_disabled? - controller.class.name.split("::").first == "Admin" || session[:disable_customization] + session[:disable_customization] end def category_badge(category, opts=nil)