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/lib/custom-wizard.js.es6
2020-03-22 04:30:11 +11:00

75 Zeilen
Kein EOL
1,2 KiB
JavaScript

function generateSelectKitContent(content) {
return content.map(i => ({id: i, name: i}))
}
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
};