mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
85c2628049
closes https://github.com/TryGhost/Team/issues/535 To ensure accent color is always set for a site, this updates brand settings screen and launch wizard to not allow empty accent color to be set or updated, adding the relevant error on the page which needs to be fixed before saving or continuing on the screens. - Shows error message for empty accent color on brand settings and launch wizard - Shows error message for invalid accent color on brand settings and launch wizard - Blocks save and continue with invalid/empty accent color on brand settings and launch wizard Co-authored-by: Peter Zimon <zimo@ghost.org>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
|
|
export default ModalComponent.extend({
|
|
config: service(),
|
|
notifications: service(),
|
|
settings: service(),
|
|
|
|
willDestroyElement() {
|
|
// reset any unsaved changes when closing
|
|
this.settings.rollbackAttributes();
|
|
},
|
|
|
|
registerPreviewIframe: action(function (element) {
|
|
this.previewIframe = element;
|
|
}),
|
|
|
|
replacePreviewContents: action(function (html) {
|
|
if (this.previewIframe) {
|
|
this.previewIframe.contentWindow.document.open();
|
|
this.previewIframe.contentWindow.document.write(html);
|
|
this.previewIframe.contentWindow.document.close();
|
|
}
|
|
}),
|
|
|
|
saveTask: task(function* () {
|
|
try {
|
|
if (this.get('settings.errors').length !== 0) {
|
|
return;
|
|
}
|
|
yield this.settings.save();
|
|
this.closeModal();
|
|
return true;
|
|
} catch (error) {
|
|
if (error) {
|
|
this.notifications.showAPIError(error);
|
|
throw error;
|
|
}
|
|
}
|
|
})
|
|
});
|