0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-20 07:41:11 +02:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-custom-field.js.es6
Angus McLeod 7b09410a26 various
2017-10-05 08:36:46 +08:00

26 Zeilen
608 B
JavaScript

import { observes } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
classNames: 'wizard-custom-field',
isDropdown: Ember.computed.equal('field.type', 'dropdown'),
init() {
this._super(...arguments);
if (!this.get('field.choices')) {
this.set('field.choices', Ember.A());
}
},
@observes('field.label')
setFieldId() {
const label = this.get('field.label');
this.set('field.id', Ember.String.underscore(label));
},
actions: {
addChoice() {
this.get('field.choices').pushObject(Ember.Object.create());
}
}
});