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

50 Zeilen
1,2 KiB
Text

2017-10-17 15:17:53 +02:00
import { default as computed } from 'ember-addons/ember-computed-decorators';
2017-10-17 09:18:53 +02:00
2017-10-22 05:37:58 +02:00
const ACTION_TYPES = [
{ id: 'create_topic', name: 'create_topic *' },
{ id: 'update_profile', name: 'update_profile *' },
{ id: 'send_message', name: 'send_message *' }
];
2017-10-17 09:18:53 +02:00
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-22 05:37:58 +02:00
types: ACTION_TYPES,
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'),
2017-10-17 15:17:53 +02:00
disableId: Ember.computed.not('action.isNew'),
2017-10-17 09:18:53 +02:00
@computed('steps')
wizardFields(steps) {
let fields = [];
steps.forEach((s) => {
2017-10-17 15:17:53 +02:00
let stepFields = s.fields.map((f) => {
return Ember.Object.create({
id: f.id,
label: `${f.id} (${s.id})`
});
});
2017-10-17 09:18:53 +02:00
fields.push(...stepFields);
});
return fields;
2017-10-13 15:02:34 +02:00
}
2017-09-23 04:34:07 +02:00
});