updated toolbar show/hide

This commit is contained in:
Adam Bradley
2015-05-06 11:31:01 -05:00
parent e36d48fdfc
commit f783be2e13
5 changed files with 18 additions and 11 deletions

View File

@ -6,9 +6,9 @@ import {
@Component({ @Component({
selector: 'ion-content', selector: 'ion-content',
hostProperties: { // hostProperties: {
contentClass: 'class.content' // contentClass: 'class.content'
} // }
}) })
@View({ @View({
template: ` template: `
@ -18,7 +18,7 @@ import {
}) })
export class Content { export class Content {
constructor() { constructor() {
this.contentClass = true; //this.contentClass = true;
console.log('Content!'); console.log('Content!');
} }
} }

View File

@ -258,6 +258,14 @@ export class NavBase {
return last && last.navItem && last.navItem._toolbars[pos] || []; return last && last.navItem && last.navItem._toolbars[pos] || [];
} }
get hideHeader() {
return !this.getToolbars('top').length;
}
get hideFooter() {
return !this.getToolbars('bottom').length;
}
canSwipeBack() { canSwipeBack() {
return !!this.getPrevious(this.getActive()); return !!this.getPrevious(this.getActive());
} }
@ -269,6 +277,7 @@ class NavStackItem {
constructor(ComponentClass, params = {}) { constructor(ComponentClass, params = {}) {
this.Class = ComponentClass; this.Class = ComponentClass;
this.params = params; this.params = params;
this.id = util.nextUid();
this._setupPromise = new Promise((resolve) => { this._setupPromise = new Promise((resolve) => {
this._resolveSetup = resolve; this._resolveSetup = resolve;
}); });

View File

@ -34,15 +34,13 @@ export class NavInjectable {}
}) })
@View({ @View({
template: ` template: `
<header class="toolbar-container" [class.hide]="getToolbars('top').length == 0"> <header class="toolbar-container" [class.hide]="hideHeader">
<div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar"></div> <div *for="#toolbar of getToolbars('top')" [toolbar-create]="toolbar"></div>
</header> </header>
<section class="nav-item-container"> <section class="nav-item-container">
<div class="nav-item" <div class="nav-item" *for="#item of navItems" [item]="item"></div>
*for="#item of navItems"
[item]="item"></div>
</section> </section>
<footer class="toolbar-container" [class.hide]="getToolbars('bottom').length == 0"> <footer class="toolbar-container" [class.hide]="hideFooter">
<div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar"></div> <div *for="#toolbar of getToolbars('bottom')" [toolbar-create]="toolbar"></div>
</footer> </footer>
`, `,

View File

@ -6,7 +6,7 @@ import {SecondPage} from 'pages/second-page'
@Component() @Component()
@View({ @View({
templateUrl: 'pages/first-page.html', templateUrl: 'pages/first-page.html',
directives: [Toolbar, Content] directives: [Toolbar]
}) })
export class FirstPage { export class FirstPage {
constructor( constructor(

View File

@ -6,7 +6,7 @@ import {ThirdPage} from 'pages/third-page'
@Component() @Component()
@View({ @View({
templateUrl: 'pages/second-page.html', templateUrl: 'pages/second-page.html',
directives: [Toolbar, Content] directives: [Toolbar]
}) })
export class SecondPage { export class SecondPage {
constructor( constructor(