mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 00:45:22 +08:00
fab36e6cf7
- Remove all `needs:` code
31 lines
831 B
JavaScript
31 lines
831 B
JavaScript
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|
|
|
export default Ember.Controller.extend(ModalFunctionality, {
|
|
notReady: Em.computed.not('ready'),
|
|
adminCustomizeCssHtml: Ember.inject.controller(),
|
|
|
|
ready: function() {
|
|
try {
|
|
const parsed = JSON.parse(this.get('customizationFile'));
|
|
return !!parsed["site_customization"];
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}.property('customizationFile'),
|
|
|
|
actions: {
|
|
createCustomization: function() {
|
|
const object = JSON.parse(this.get('customizationFile')).site_customization;
|
|
|
|
// Slight fixup before creating object
|
|
object.enabled = false;
|
|
delete object.id;
|
|
delete object.key;
|
|
|
|
const controller = this.get('adminCustomizeCssHtml');
|
|
controller.send('newCustomization', object);
|
|
}
|
|
}
|
|
|
|
});
|