Added API call to create new custom fields
This commit is contained in:
parent
175b8eb94d
commit
1469e08063
4 changed files with 99 additions and 5 deletions
|
@ -7,6 +7,7 @@ let lists = require('./lists');
|
|||
let shortid = require('shortid');
|
||||
|
||||
let allowedKeys = ['name', 'key', 'default_value', 'group', 'visible'];
|
||||
let allowedTypes;
|
||||
|
||||
module.exports.grouped = ['radio', 'checkbox', 'dropdown'];
|
||||
module.exports.types = {
|
||||
|
@ -25,6 +26,8 @@ module.exports.types = {
|
|||
option: 'Option'
|
||||
};
|
||||
|
||||
module.exports.allowedTypes = allowedTypes = Object.keys(module.exports.types);
|
||||
|
||||
module.exports.genericTypes = {
|
||||
text: 'string',
|
||||
website: 'string',
|
||||
|
@ -268,7 +271,6 @@ function addCustomField(listId, name, defaultValue, type, group, visible, callba
|
|||
|
||||
let column = null;
|
||||
let key = slugify('merge ' + name, '_').toUpperCase();
|
||||
let allowedTypes = ['text', 'number', 'radio', 'checkbox', 'dropdown', 'date-us', 'date-eur', 'birthday-us', 'birthday-eur', 'website', 'option', 'gpg', 'longtext'];
|
||||
|
||||
if (allowedTypes.indexOf(type) < 0) {
|
||||
return callback(new Error('Unknown column type ' + type));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue