Changed TabBar controller to use setVisible

This makes it a little more generic and we can easily override this in
an Angular controller.
This commit is contained in:
Max Lynch
2013-09-17 17:03:32 -05:00
parent b4e42a42f7
commit 8c26932c7b
2 changed files with 20 additions and 17 deletions

View File

@ -59,11 +59,13 @@ TabBarController.prototype = {
for(var i = 0, j = this.controllers.length; i < j; i ++) {
c = this.controllers[i];
c.detach && c.detach();
//c.detach && c.detach();
c.setVisible(false);
}
c = this.controllers[index];
c.attach && c.attach();
//c.attach && c.attach();
c.setVisible(true);
},
_clearSelected: function() {

View File

@ -76,7 +76,13 @@
this.el = opts.el;
}
controller.prototype = {
detach: function() {
setVisible: function(isVisible) {
if(isVisible) {
//this.el.style.display = 'block';
if(this._lastNodeSpot) {
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
}
} else {
//this.el.style.display = 'none';
var parentNode = this.el.parentNode;
if(!parentNode) {
@ -86,13 +92,8 @@
this._lastNodeSpot = next;
this._lastNodeParent = parentNode;
parentNode.removeChild(this.el);
}
},
attach: function() {
//this.el.style.display = 'block';
if(this._lastNodeSpot) {
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
}
}
};
var c1 = new controller({