mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 22:53:32 +03:00
80357855aa
no refs. - added static price modal to product detail page
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency-decorators';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class ProductController extends Controller {
|
|
@service settings;
|
|
|
|
@tracked showLeaveSettingsModal = false;
|
|
@tracked showPriceModal = false;
|
|
|
|
leaveRoute(transition) {
|
|
if (this.settings.get('hasDirtyAttributes')) {
|
|
transition.abort();
|
|
this.leaveSettingsTransition = transition;
|
|
this.showLeaveSettingsModal = true;
|
|
}
|
|
}
|
|
|
|
@action
|
|
async confirmLeave() {
|
|
this.settings.rollbackAttributes();
|
|
this.showLeaveSettingsModal = false;
|
|
this.leaveSettingsTransition.retry();
|
|
}
|
|
|
|
@action
|
|
cancelLeave() {
|
|
this.showLeaveSettingsModal = false;
|
|
this.leaveSettingsTransition = null;
|
|
}
|
|
|
|
@action
|
|
closePriceModal() {
|
|
this.showPriceModal = false;
|
|
}
|
|
|
|
@task({drop: true})
|
|
*saveTask() {
|
|
return yield this.settings.save();
|
|
}
|
|
}
|