2017-10-17 09:18:53 +02:00
|
|
|
import { on, observes, default as computed } from 'ember-addons/ember-computed-decorators';
|
|
|
|
|
|
|
|
const PROFILE_FIELDS = [
|
|
|
|
'name',
|
|
|
|
'email',
|
|
|
|
'username',
|
|
|
|
'title',
|
|
|
|
'date_of_birth',
|
|
|
|
'muted_usernames',
|
|
|
|
'theme_key',
|
|
|
|
'locale',
|
|
|
|
'bio_raw',
|
|
|
|
'location',
|
|
|
|
'website',
|
|
|
|
'dismissed_banner_key',
|
|
|
|
'profile_background',
|
|
|
|
'card_background'
|
|
|
|
];
|
2017-10-13 15:02:34 +02:00
|
|
|
|
2017-09-23 04:34:07 +02:00
|
|
|
export default Ember.Component.extend({
|
2017-10-06 04:59:02 +02:00
|
|
|
classNames: 'wizard-custom-action',
|
2017-10-05 02:36:46 +02:00
|
|
|
types: ['create_topic', 'update_profile', 'send_message'],
|
2017-10-17 09:18:53 +02:00
|
|
|
profileFields: PROFILE_FIELDS,
|
2017-10-05 02:36:46 +02:00
|
|
|
createTopic: Ember.computed.equal('action.type', 'create_topic'),
|
|
|
|
updateProfile: Ember.computed.equal('action.type', 'update_profile'),
|
2017-10-13 15:02:34 +02:00
|
|
|
sendMessage: Ember.computed.equal('action.type', 'send_message'),
|
|
|
|
|
|
|
|
@on('init')
|
|
|
|
@observes('action')
|
|
|
|
setup() {
|
2017-10-17 09:18:53 +02:00
|
|
|
if (!this.get('isNew')) this.set('existingId', this.get('action.id'));
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('steps')
|
|
|
|
wizardFields(steps) {
|
|
|
|
let fields = [];
|
|
|
|
steps.forEach((s) => {
|
|
|
|
let stepFields = s.fields.map((f) => `${f.id} (${s.id})`);
|
|
|
|
fields.push(...stepFields);
|
|
|
|
});
|
|
|
|
return fields;
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('action.profile_updates.[]')
|
|
|
|
profileUpdates: fields => fields,
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
addProfileUpdate() {
|
|
|
|
if (!this.get('action.profile_updates')) {
|
|
|
|
this.set('action.profile_updates', Ember.A());
|
|
|
|
}
|
|
|
|
this.get('action.profile_updates').pushObject(Ember.Object.create());
|
|
|
|
},
|
|
|
|
|
|
|
|
removeProfileUpdate(f) {
|
|
|
|
this.get('action.profile_updates').removeObject(f);
|
|
|
|
}
|
2017-10-13 15:02:34 +02:00
|
|
|
}
|
2017-09-23 04:34:07 +02:00
|
|
|
});
|