* Fixed actionKeys to have full conf data including extraArgs
This commit is contained in:
parent
899cb658cc
commit
d23012a201
|
@ -43,22 +43,20 @@ function ViewController(options) {
|
||||||
// Everything else is forwarded on to the focused View, if any.
|
// Everything else is forwarded on to the focused View, if any.
|
||||||
//
|
//
|
||||||
if(key) {
|
if(key) {
|
||||||
var actionForKey = self.actionKeyMap[key.name];
|
var actionForKey = self.actionKeyMap[key.name]
|
||||||
if(actionForKey) {
|
if(actionForKey) {
|
||||||
if(_.isNumber(actionForKey)) {
|
if(_.isNumber(actionForKey.viewId)) {
|
||||||
//
|
//
|
||||||
// Key works on behalf of a view -- switch focus & submit
|
// Key works on behalf of a view -- switch focus & submit
|
||||||
//
|
//
|
||||||
self.switchFocus(actionForKey);
|
self.switchFocus(actionForKey.viewId);
|
||||||
self.submitForm(key);
|
self.submitForm(key);
|
||||||
} else if(_.isString(actionForKey)) {
|
} else if(_.isString(actionForKey.action)) {
|
||||||
// :TODO: Populate formData here?
|
menuUtil.handleAction(
|
||||||
// :TODO: Populate actionBlock here -- that is, the actionKey entry... or
|
self.client,
|
||||||
// really we just need |extraArgs| to be present, if any
|
{ key : key }, // formData
|
||||||
menuUtil.handleAction(self.client, { key : key }, { action : actionForKey } );
|
actionForKey); // action block
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +625,6 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actionKeyEntry;
|
|
||||||
formConfig.actionKeys.forEach(function akEntry(ak) {
|
formConfig.actionKeys.forEach(function akEntry(ak) {
|
||||||
//
|
//
|
||||||
// * 'keys' must be present and be an array of key names
|
// * 'keys' must be present and be an array of key names
|
||||||
|
@ -636,24 +633,16 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
||||||
// * If 'action' is present, that action will be procesed when
|
// * If 'action' is present, that action will be procesed when
|
||||||
// triggered by key(s)
|
// triggered by key(s)
|
||||||
//
|
//
|
||||||
// Ultimately, we'll create a map of key -> { viewId | action }
|
// Ultimately, create a map of key -> { action block }
|
||||||
//
|
//
|
||||||
// :TODO: allow for args to be passed along with action as well...
|
|
||||||
if(!_.isArray(ak.keys)) {
|
if(!_.isArray(ak.keys)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_.isNumber(ak.viewId)) {
|
|
||||||
actionKeyEntry = ak.viewId;
|
|
||||||
} else if(_.isString(ak.action)) {
|
|
||||||
actionKeyEntry = ak.action;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ak.keys.forEach(function actionKeyName(kn) {
|
ak.keys.forEach(function actionKeyName(kn) {
|
||||||
self.actionKeyMap[kn] = actionKeyEntry;
|
self.actionKeyMap[kn] = ak;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
callback(null);
|
callback(null);
|
||||||
|
|
Loading…
Reference in New Issue