mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
2a77c0fe51
no issue - list custom post views in collapsable sidebar navigation - default views: Draft, Scheduled, Published (except for contributors) - record expanded/collapsed state of the navigation menus in user settings via new `navigation` service - adds `customViews` service that manages custom views - provides list of default views - gives access to "active" custom view based on current route and query params - manages loading/saving of custom views to user settings - show "Add view" button in the content filter when the posts list has been filtered - show "Edit view" button in the content filter when the posts list filter matches a saved view Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import ModalComponent from 'ghost-admin/components/modal-base';
|
|
import {inject as service} from '@ember/service';
|
|
import {task, timeout} from 'ember-concurrency';
|
|
|
|
export default ModalComponent.extend({
|
|
customViews: service(),
|
|
|
|
delayedModelColor: '',
|
|
|
|
confirm() {},
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
this.set('model', this.customViews.editView());
|
|
this._setDelayedModelColor.perform();
|
|
},
|
|
|
|
actions: {
|
|
changeColor(event) {
|
|
let color = event.target.value;
|
|
this.set('model.color', color);
|
|
this.set('delayedModelColor', color);
|
|
},
|
|
|
|
confirm() {
|
|
return this.saveTask.perform();
|
|
}
|
|
},
|
|
|
|
saveTask: task(function* () {
|
|
let view = yield this.customViews.saveViewTask.perform(this.model);
|
|
this.send('closeModal');
|
|
return view;
|
|
}),
|
|
|
|
deleteTask: task(function* () {
|
|
let view = yield this.customViews.deleteViewTask.perform(this.model);
|
|
this.send('closeModal');
|
|
return view;
|
|
}),
|
|
|
|
// this is a hack to get around radio buttons not working with liquid-fire.
|
|
// The DOM is duplicated whilst animating-in so browsers end up setting the
|
|
// checked property on the temporary DOM. Delaying the value being set
|
|
// allows us to ensure we're updating the checked property after animation
|
|
_setDelayedModelColor: task(function* () {
|
|
yield timeout(200);
|
|
this.set('delayedModelColor', this.model.color);
|
|
})
|
|
});
|