* Distinct "menus" vs "prompts" for theme.json so conflicting names can occur
* Add support for theming prompts
This commit is contained in:
parent
34bf823f1f
commit
4e2c21059a
|
@ -217,18 +217,18 @@ function applyThemeCustomization(options) {
|
||||||
// options.name : menu/prompt name
|
// options.name : menu/prompt name
|
||||||
// options.configMci : menu or prompt config (menu.json / prompt.json) specific mci section
|
// options.configMci : menu or prompt config (menu.json / prompt.json) specific mci section
|
||||||
// options.client : client
|
// options.client : client
|
||||||
|
// options.type : menu|prompt
|
||||||
//
|
//
|
||||||
assert(_.isString(options.name));
|
assert(_.isString(options.name));
|
||||||
|
assert("menus" === options.type || "prompts" === options.type);
|
||||||
assert(_.isObject(options.client));
|
assert(_.isObject(options.client));
|
||||||
|
|
||||||
console.log(options.configMci)
|
|
||||||
|
|
||||||
if(_.isUndefined(options.configMci)) {
|
if(_.isUndefined(options.configMci)) {
|
||||||
options.configMci = {};
|
options.configMci = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_.has(options.client.currentTheme, [ 'customization', 'byName', options.name ])) {
|
if(_.has(options.client.currentTheme, [ 'customization', options.type, options.name ])) {
|
||||||
var themeConfig = options.client.currentTheme.customization.byName[options.name];
|
var themeConfig = options.client.currentTheme.customization[options.type][options.name];
|
||||||
Object.keys(themeConfig).forEach(function mciEntry(mci) {
|
Object.keys(themeConfig).forEach(function mciEntry(mci) {
|
||||||
_.defaults(options.configMci[mci], themeConfig[mci]);
|
_.defaults(options.configMci[mci], themeConfig[mci]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -397,6 +397,17 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
function applyThemeCustomization(callback) {
|
||||||
|
if(_.isObject(promptConfig)) {
|
||||||
|
menuUtil.applyThemeCustomization({
|
||||||
|
name : self.client.currentMenuModule.menuConfig.prompt,
|
||||||
|
type : "prompts",
|
||||||
|
client : self.client,
|
||||||
|
configMci : promptConfig.mci,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
callback(null);
|
||||||
|
},
|
||||||
function applyViewConfiguration(callback) {
|
function applyViewConfiguration(callback) {
|
||||||
if(_.isObject(promptConfig.mci)) {
|
if(_.isObject(promptConfig.mci)) {
|
||||||
self.applyViewConfig(promptConfig, function configApplied(err, info) {
|
self.applyViewConfig(promptConfig, function configApplied(err, info) {
|
||||||
|
@ -511,18 +522,15 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
||||||
if(_.isObject(formConfig)) {
|
if(_.isObject(formConfig)) {
|
||||||
menuUtil.applyThemeCustomization({
|
menuUtil.applyThemeCustomization({
|
||||||
name : self.client.currentMenuModule.menuName,
|
name : self.client.currentMenuModule.menuName,
|
||||||
|
type : "menus",
|
||||||
client : self.client,
|
client : self.client,
|
||||||
configMci : formConfig.mci,
|
configMci : formConfig.mci,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(test)
|
|
||||||
|
|
||||||
callback(null);
|
callback(null);
|
||||||
},
|
},
|
||||||
function applyViewConfiguration(callback) {
|
function applyViewConfiguration(callback) {
|
||||||
//
|
|
||||||
// :TODO: need to merge configs from menu -> theme (specific) -> theme (default) -> defaults
|
|
||||||
if(_.isObject(formConfig)) {
|
if(_.isObject(formConfig)) {
|
||||||
self.applyViewConfig(formConfig, function configApplied(err, info) {
|
self.applyViewConfig(formConfig, function configApplied(err, info) {
|
||||||
initialFocusId = info.initialFocusId;
|
initialFocusId = info.initialFocusId;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"byName" : {
|
"menus" : {
|
||||||
"matrix" : {
|
"matrix" : {
|
||||||
"VM1" : {
|
"VM1" : {
|
||||||
"itemSpacing" : 1
|
"itemSpacing" : 1
|
||||||
|
@ -32,6 +32,12 @@
|
||||||
"ET9" : { "width" : 21 },
|
"ET9" : { "width" : 21 },
|
||||||
"ET10" : { "width" : 21 }
|
"ET10" : { "width" : 21 }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"prompts" : {
|
||||||
|
"userCredentials" : {
|
||||||
|
"ET1" : { "width" : 21 },
|
||||||
|
"ET2" : { "width" : 21 }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,14 +4,12 @@
|
||||||
"mci" : {
|
"mci" : {
|
||||||
"ET1" : {
|
"ET1" : {
|
||||||
"argName" : "username",
|
"argName" : "username",
|
||||||
"width" : 15,
|
|
||||||
"maxLength" : "@config:users.usernameMax"
|
"maxLength" : "@config:users.usernameMax"
|
||||||
},
|
},
|
||||||
"ET2" : {
|
"ET2" : {
|
||||||
"submit" : true,
|
"submit" : true,
|
||||||
"argName" : "password",
|
"argName" : "password",
|
||||||
"password" : true,
|
"password" : true,
|
||||||
"width" : 15,
|
|
||||||
"maxLength" : "@config:users.passwordMax"
|
"maxLength" : "@config:users.passwordMax"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue