0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-custom-step.js.es6
Angus McLeod 7b09410a26 various
2017-10-05 08:36:46 +08:00

26 Zeilen
674 B
JavaScript

import { default as computed } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
classNames: 'wizard-custom-step',
@computed('step.fields.@each.id')
allowAddAction: stepFields => stepFields.get('firstObject.id'),
actions: {
addField() {
this.get('step.fields').pushObject(Ember.Object.create({ id: '', label: '' }));
},
addAction() {
this.get('step.actions').pushObject(Ember.Object.create({ id: '', label: '' }));
},
removeField(field) {
this.get('step.fields').removeObject(field);
},
removeAction(action) {
this.get('step.actions').removeObject(action);
}
}
});