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-action.js.es6
2017-10-17 21:17:53 +08:00

43 Zeilen
1,1 KiB
JavaScript

import { 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'
];
export default Ember.Component.extend({
classNames: 'wizard-custom-action',
types: ['create_topic', 'update_profile', 'send_message'],
profileFields: PROFILE_FIELDS,
createTopic: Ember.computed.equal('action.type', 'create_topic'),
updateProfile: Ember.computed.equal('action.type', 'update_profile'),
sendMessage: Ember.computed.equal('action.type', 'send_message'),
disableId: Ember.computed.not('action.isNew'),
@computed('steps')
wizardFields(steps) {
let fields = [];
steps.forEach((s) => {
let stepFields = s.fields.map((f) => {
return Ember.Object.create({
id: f.id,
label: `${f.id} (${s.id})`
});
});
fields.push(...stepFields);
});
return fields;
}
});