123456789101112131415161718192021222324252627282930313233343536 |
- import { default as computed } from 'ember-addons/ember-computed-decorators';
- export default Ember.Controller.extend({
- @computed('model.id', 'model.name')
- wizardUrl(wizardId) {
- return window.location.origin + '/w/' + Ember.String.dasherize(wizardId);
- },
- actions: {
- save() {
- this.setProperties({
- saving: true,
- error: null
- });
- const wizard = this.get('model');
- wizard.save().then(() => {
- this.set('saving', false);
- if (this.get('newWizard')) {
- this.send("refreshAllWizards");
- } else {
- this.send("refreshWizard");
- }
- }).catch((error) => {
- this.set('saving', false);
- this.set('error', I18n.t(`admin.wizard.error.${error}`));
- Ember.run.later(() => this.set('error', null), 10000);
- });
- },
- remove() {
- this.get('model').remove().then(() => {
- this.send("refreshAllWizards");
- });
- }
- }
- });
|