tab navbars

This commit is contained in:
Adam Bradley
2015-06-12 16:13:11 -05:00
parent d698777421
commit 603a61d070
3 changed files with 54 additions and 6 deletions

View File

@@ -40,7 +40,6 @@ export class Navbar {
constructor(item: ViewItem, elementRef: ElementRef) {
item.navbarElement(elementRef.domElement);
}
}
@Directive({

View File

@@ -212,7 +212,7 @@ export class ViewController {
let swipeBackPromise = new Promise(res => { this.sbResolve = res; });
swipeBackPromise.then((completeSwipeBack) => {
console.log('completeSwipeBack', completeSwipeBack)
if (completeSwipeBack) {
// swipe back has completed, update each item's state
enteringItem.state = ACTIVE_STATE;

View File

@@ -199,29 +199,78 @@ export class ViewItem {
navbarElement() {
if (arguments.length) {
this._nbEle = arguments[0];
return;
}
if (this._nbEle) {
// this ViewItem already has an assigned navbarElement
return this._nbEle;
}
let instance = this.instance;
if (instance && instance.parentNavbar && instance.parentNavbar()) {
// this View doesn't actually have it's own navbar
// for example, Tab does not have a navbar, but Tabs does
// so if this is true, then get the active ViewItem inside this instance
let activeChildViewItem = instance.getActive();
if (activeChildViewItem) {
return activeChildViewItem.navbarElement();
}
}
return this._nbEle;
}
titleElement() {
if (arguments.length) {
this._ttEle = arguments[0];
return;
}
if (this._ttEle) {
return this._ttEle;
}
let instance = this.instance;
if (instance && instance.parentNavbar && instance.parentNavbar()) {
let activeChildViewItem = instance.getActive();
if (activeChildViewItem) {
return activeChildViewItem.titleElement();
}
}
return this._ttEle;
}
backButtonElement() {
if (arguments.length) {
this._bbEle = arguments[0];
return;
}
if (this._bbEle) {
return this._bbEle;
}
let instance = this.instance;
if (instance && instance.parentNavbar && instance.parentNavbar()) {
let activeChildViewItem = instance.getActive();
if (activeChildViewItem) {
return activeChildViewItem.backButtonElement();
}
}
return this._bbEle;
}
navbarItemElements() {
if (arguments.length) {
this._nbItms.push(arguments[0]);
return;
}
if (this._nbItms) {
return this._nbItms;
}
let instance = this.instance;
if (instance && instance.parentNavbar && instance.parentNavbar()) {
let activeChildViewItem = instance.getActive();
if (activeChildViewItem) {
return activeChildViewItem.navbarItemElements();
}
}
return this._nbItms;
}