mirror of
https://github.com/discourse/discourse.git
synced 2025-02-04 18:45:17 +08:00
31 lines
827 B
JavaScript
31 lines
827 B
JavaScript
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|
|
|
export default Ember.Controller.extend(ModalFunctionality, {
|
|
notReady: Em.computed.not('ready'),
|
|
needs: ['adminCustomizeCssHtml'],
|
|
|
|
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('controllers.adminCustomizeCssHtml');
|
|
controller.send('newCustomization', object);
|
|
}
|
|
}
|
|
|
|
});
|