Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
quick hack bugfix for tabbar
Browse files Browse the repository at this point in the history
tabbar children should be views not array or object
  • Loading branch information
hano committed Dec 13, 2013
1 parent ae3aff8 commit 20fea44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/ui/layouts/tab-layout.js
Expand Up @@ -127,6 +127,12 @@ M.TabLayout = M.Layout.extend({
}
}
}).create();
},

//TODO
_mergeChildView: function(selector, view){
this.childViews[selector] = view;
return this;
}

});
17 changes: 14 additions & 3 deletions src/ui/views/view.js
Expand Up @@ -714,12 +714,23 @@
*/
addChildView: function( selector, view ) {
if( _.isObject(selector) ) {
// this can be an object if the you use it as addChildViews function
/**
* @example
*
* var children = {
* b1: M.View.extend(),
* b2: M.View.extend()
* };
*
* M.View.create().addChildView(children);
*
*/
_.each(selector, function( view, selector ) {
this._mergeChildView(selector, view);

}, this);
} else {
this._mergeChildView(selector, view);
return this._mergeChildView(selector, view);
}
return this;
},
Expand All @@ -732,7 +743,7 @@
*/
_mergeChildView: function( selector, view ) {
if( !(_.isString(selector)) || !(M.isView(view)) ) {
return;
return void 0;
}

var existingChildViews = this.childViews[selector];
Expand Down

0 comments on commit 20fea44

Please sign in to comment.