* WIP on new view validation framework
This commit is contained in:
parent
964b899fe5
commit
743035683c
|
@ -157,6 +157,16 @@ function ViewController(options) {
|
|||
|
||||
case 'method' :
|
||||
case 'systemMethod' :
|
||||
if('validate' === propName) {
|
||||
// :TODO: handle propAsset.location for @method script specification
|
||||
if('systemMethod' === propAsset.type) {
|
||||
// :TODO: implementation validation @systemMethod handling!
|
||||
} else {
|
||||
if(_.isFunction(self.client.currentMenuModule.menuMethods[propAsset.asset])) {
|
||||
propValue = self.client.currentMenuModule.menuMethods[propAsset.asset];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(_.isString(propAsset.location)) {
|
||||
|
||||
} else {
|
||||
|
@ -171,6 +181,7 @@ function ViewController(options) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
|
@ -362,7 +373,40 @@ ViewController.prototype.setFocus = function(focused) {
|
|||
};
|
||||
|
||||
ViewController.prototype.switchFocus = function(id) {
|
||||
//this.setFocus(true); // ensure events are attached
|
||||
//
|
||||
// Perform focus switching validation now
|
||||
//
|
||||
var self = this;
|
||||
var focusedView = self.focusedView;
|
||||
|
||||
function performSwitch() {
|
||||
self.attachClientEvents();
|
||||
|
||||
// remove from old
|
||||
self.setViewFocusWithEvents(focusedView, false);
|
||||
|
||||
// set to new
|
||||
self.setViewFocusWithEvents(self.getView(id), true);
|
||||
};
|
||||
|
||||
|
||||
if(focusedView && focusedView.validate) {
|
||||
focusedView.validate(focusedView.getData(), function validated(isValid, msgProp) {
|
||||
if(isValid) {
|
||||
performSwitch();
|
||||
} else {
|
||||
if(_.isFunction(self.client.currentMenuModule.menuMethods.validationFailure)) {
|
||||
self.client.currentMenuModule.menuMethods.validationFailure(focusedView, msgProp, function validateFailNext() {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
performSwitch();
|
||||
}
|
||||
|
||||
/*
|
||||
this.attachClientEvents();
|
||||
|
||||
// remove from old
|
||||
|
@ -370,15 +414,19 @@ ViewController.prototype.switchFocus = function(id) {
|
|||
|
||||
// set to new
|
||||
this.setViewFocusWithEvents(this.getView(id), true);
|
||||
*/
|
||||
};
|
||||
|
||||
ViewController.prototype.nextFocus = function() {
|
||||
var nextId;
|
||||
|
||||
if(!this.focusedView) {
|
||||
this.switchFocus(this.views[this.firstId].id);
|
||||
nextId = this.views[this.firstId].id;
|
||||
} else {
|
||||
var nextId = this.views[this.focusedView.id].nextId;
|
||||
this.switchFocus(nextId);
|
||||
nextId = this.views[this.focusedView.id].nextId;
|
||||
}
|
||||
|
||||
this.switchFocus(nextId);
|
||||
};
|
||||
|
||||
ViewController.prototype.setViewOrder = function(order) {
|
||||
|
|
Loading…
Reference in New Issue