mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 18:14:45 +08:00
FEATURE: add .admin-interface class to BODY when in admin
removes some dead code as well
This commit is contained in:
11
app/assets/javascripts/admin/components/admin-wrapper.js.es6
Normal file
11
app/assets/javascripts/admin/components/admin-wrapper.js.es6
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export default Ember.Component.extend({
|
||||||
|
didInsertElement() {
|
||||||
|
this._super();
|
||||||
|
$('body').addClass('admin-interface');
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this._super();
|
||||||
|
$('body').removeClass('admin-interface');
|
||||||
|
}
|
||||||
|
});
|
@ -1,14 +0,0 @@
|
|||||||
export default Ember.Component.extend({
|
|
||||||
willInsertElement() {
|
|
||||||
this._super();
|
|
||||||
if (this.session.get("disableCustomCSS")) {
|
|
||||||
$("link.custom-css").attr("rel", "");
|
|
||||||
this.session.set("disableCustomCSS", false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
willDestroyElement() {
|
|
||||||
this._super();
|
|
||||||
$("link.custom-css").attr("rel", "stylesheet");
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,4 +1,4 @@
|
|||||||
{{#disable-custom-stylesheets class="container"}}
|
{{#admin-wrapper class="container"}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
|
|
||||||
@ -34,4 +34,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/disable-custom-stylesheets}}
|
{{/admin-wrapper}}
|
||||||
|
@ -7,22 +7,6 @@ export default {
|
|||||||
initialize(container) {
|
initialize(container) {
|
||||||
const messageBus = container.lookup('message-bus:main');
|
const messageBus = container.lookup('message-bus:main');
|
||||||
|
|
||||||
// subscribe to any site customizations that are loaded
|
|
||||||
$('link.custom-css').each(function() {
|
|
||||||
const split = this.href.split("/"),
|
|
||||||
id = split[split.length - 1].split(".css")[0],
|
|
||||||
self = this;
|
|
||||||
|
|
||||||
return messageBus.subscribe("/file-change/" + id, function(data) {
|
|
||||||
if (!$(self).data('orig')) {
|
|
||||||
$(self).data('orig', self.href);
|
|
||||||
}
|
|
||||||
const orig = $(self).data('orig');
|
|
||||||
|
|
||||||
self.href = orig.replace(/v=.*/, "v=" + data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Custom header changes
|
// Custom header changes
|
||||||
$('header.custom').each(function() {
|
$('header.custom').each(function() {
|
||||||
const header = $(this);
|
const header = $(this);
|
||||||
|
Reference in New Issue
Block a user