2017-09-23 04:34:07 +02:00
|
|
|
import { observes } from 'ember-addons/ember-computed-decorators';
|
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
|
|
|
classNames: 'wizard-custom-field',
|
|
|
|
isDropdown: Ember.computed.equal('field.type', 'dropdown'),
|
2017-09-24 05:01:18 +02:00
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
|
|
|
|
|
|
|
if (!this.get('field.choices')) {
|
|
|
|
this.set('field.choices', Ember.A());
|
|
|
|
}
|
|
|
|
},
|
2017-09-23 04:34:07 +02:00
|
|
|
|
|
|
|
@observes('field.label')
|
|
|
|
setFieldId() {
|
|
|
|
const label = this.get('field.label');
|
|
|
|
this.set('field.id', Ember.String.underscore(label));
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
addChoice() {
|
2017-09-24 05:01:18 +02:00
|
|
|
this.get('field.choices').pushObject(Ember.Object.create());
|
2017-09-23 04:34:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|