wizard-custom-action.js.es6 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { default as computed } from 'ember-addons/ember-computed-decorators';
  2. const PROFILE_FIELDS = [
  3. 'name',
  4. 'email',
  5. 'username',
  6. 'title',
  7. 'date_of_birth',
  8. 'muted_usernames',
  9. 'theme_key',
  10. 'locale',
  11. 'bio_raw',
  12. 'location',
  13. 'website',
  14. 'dismissed_banner_key',
  15. 'profile_background',
  16. 'card_background'
  17. ];
  18. export default Ember.Component.extend({
  19. classNames: 'wizard-custom-action',
  20. types: ['create_topic', 'update_profile', 'send_message'],
  21. profileFields: PROFILE_FIELDS,
  22. createTopic: Ember.computed.equal('action.type', 'create_topic'),
  23. updateProfile: Ember.computed.equal('action.type', 'update_profile'),
  24. sendMessage: Ember.computed.equal('action.type', 'send_message'),
  25. disableId: Ember.computed.not('action.isNew'),
  26. @computed('steps')
  27. wizardFields(steps) {
  28. let fields = [];
  29. steps.forEach((s) => {
  30. let stepFields = s.fields.map((f) => {
  31. return Ember.Object.create({
  32. id: f.id,
  33. label: `${f.id} (${s.id})`
  34. });
  35. });
  36. fields.push(...stepFields);
  37. });
  38. return fields;
  39. }
  40. });