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 a43f4b1344 various
2017-10-07 10:27:38 +08:00

28 Zeilen
670 B
JavaScript

import { default as computed, on, observes } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
classNames: 'wizard-custom-field',
isDropdown: Ember.computed.equal('field.type', 'dropdown'),
@on('init')
@observes('field.id')
init() {
this._super(...arguments);
if (!this.get('field.choices')) {
this.set('field.choices', Ember.A());
}
},
@computed('field.choices.[]')
dropdownChoices: choices => choices,
actions: {
addChoice() {
this.get('field.choices').pushObject(Ember.Object.create());
},
removeChoice(c) {
this.get('field.choices').removeObject(c);
}
}
});