Convert organization Select to Lookup

This commit is contained in:
gconsidine
2017-06-22 16:11:04 -04:00
parent d7e78a5884
commit dc1bff9048
20 changed files with 474 additions and 327 deletions
+14 -13
View File
@@ -77,25 +77,24 @@ function httpOptions (resource) {
});
}
function get (method, keys) {
let model;
function options (keys) {
return this.find('options', keys);
}
if (keys) {
model = this.model[method.toUpperCase()];
} else {
model = this.model.GET;
keys = method;
}
function get (keys) {
return this.find('get', keys);
}
function find (method, keys) {
let value = this.model[method.toUpperCase()];
if (!keys) {
return model;
return value;
}
keys = keys.split('.');
let value = model;
try {
keys = keys.split('.');
keys.forEach(key => {
let bracketIndex = key.indexOf('[');
let hasArray = bracketIndex !== -1;
@@ -137,6 +136,8 @@ function getById (id) {
function BaseModel (path) {
this.model = {};
this.get = get;
this.options = options;
this.find = find;
this.normalizePath = normalizePath;
this.getById = getById;
this.request = request;
+1 -1
View File
@@ -3,7 +3,7 @@ const ENCRYPTED_VALUE = '$encrypted$';
let BaseModel;
function createFormSchema (method, config) {
let schema = Object.assign({}, this.get('options', `actions.${method.toUpperCase()}`));
let schema = Object.assign({}, this.options(`actions.${method.toUpperCase()}`));
if (config && config.omit) {
config.omit.forEach(key => {