wizard-custom-action.js.es6 1.2 KB

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