0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/assets/javascripts/discourse/lib/custom-wizard.js.es6

75 Zeilen
1,2 KiB
Text

2020-02-02 11:42:05 +01:00
function generateSelectKitContent(content) {
return content.map(i => ({id: i, name: i}))
}
2020-03-21 18:30:11 +01:00
function generateName(id) {
return id.replace(/[_\-]+/g, ' ')
.toLowerCase()
.replace(/(^\w|\b\w)/g, (m) => m.toUpperCase())
}
const profileFields = [
'name',
'user_avatar',
'date_of_birth',
'title',
'locale',
'location',
'website',
'bio_raw',
'profile_background',
'card_background',
'theme_id'
];
const connectors = [
'equal'
]
const actionTypes = [
'create_topic',
'update_profile',
'create_topic',
'update_profile',
'send_message',
'send_to_api',
'add_to_group',
'route_to',
'open_composer'
];
function newInput(options = {}) {
let params = {
pairs: Ember.A([newPair(options, 0)])
}
if (options.hasOutput) {
params['output'] = '';
params['output_type'] = 'text';
}
return Ember.Object.create(params);
}
function newPair(options = {}, index) {
let params = {
index,
key: '',
key_type: 'text',
value: '',
value_type: 'text',
connector: 'equal'
}
return Ember.Object.create(params);
}
export {
generateSelectKitContent,
profileFields,
actionTypes,
generateName,
connectors,
newInput,
newPair
};