wizard-custom-field.js.es6 608 B

1234567891011121314151617181920212223242526
  1. import { observes } from 'ember-addons/ember-computed-decorators';
  2. export default Ember.Component.extend({
  3. classNames: 'wizard-custom-field',
  4. isDropdown: Ember.computed.equal('field.type', 'dropdown'),
  5. init() {
  6. this._super(...arguments);
  7. if (!this.get('field.choices')) {
  8. this.set('field.choices', Ember.A());
  9. }
  10. },
  11. @observes('field.label')
  12. setFieldId() {
  13. const label = this.get('field.label');
  14. this.set('field.id', Ember.String.underscore(label));
  15. },
  16. actions: {
  17. addChoice() {
  18. this.get('field.choices').pushObject(Ember.Object.create());
  19. }
  20. }
  21. });