From 69f08ef3f69509432a2acfb2099a099aaa92d958 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 14 May 2015 10:01:16 -0500 Subject: [PATCH] toolbar thingz --- ionic/components/app/structure.scss | 31 +++++++-------- .../nav/test/basic/pages/first-page.html | 8 ++-- .../nav/test/basic/pages/first-page.js | 4 +- .../nav/test/basic/pages/second-page.html | 6 +-- .../nav/test/basic/pages/second-page.js | 4 +- .../nav/test/basic/pages/third-page.html | 6 +-- .../nav/test/basic/pages/third-page.js | 4 +- ionic/components/toolbar/toolbar.js | 38 +++++++++++++------ 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/ionic/components/app/structure.scss b/ionic/components/app/structure.scss index e7e8ee19f6..8fb1531140 100644 --- a/ionic/components/app/structure.scss +++ b/ionic/components/app/structure.scss @@ -1,4 +1,5 @@ -html, body { +html, +body { height: 100%; } @@ -28,7 +29,7 @@ ion-app { } .toolbar-container { - // container of many toolbars for each view in the .nav + // container of many toolbars for each view in the ion-nav position: relative; width: 100%; min-height: 50px; @@ -39,11 +40,12 @@ ion-app { @include flex-order($flex-order-toolbar-bottom); } - .toolbar { - // one view's toolbar, sibling to many view toolbars insde of .toolbar-container + ion-toolbar { + // one view's toolbar, sibling to many view toolbars inside of .toolbar-container position: absolute; top: 0; left: 0; + display: block; width: 100%; height: 100%; } @@ -63,29 +65,21 @@ ion-app { @include flex-order($flex-order-view-content); } - .nav-item-cover-parent { - // .nav-item that should completely cover siblings and parent - top: -50px; - height: 100vh; - } - .nav-item { - // by default .nav-item is hidden - // and the transition animation will display it - display: none; - } - - .nav-item, - .nav-item-child { - // user created view, contained by .nav-item + // user created view, sibling to many .nav-item's, contained by .nav-item-container position: absolute; top: 0; left: 0; width: 100%; height: 100%; + + // by default .nav-item is hidden + // and the transition animation will display it + display: none; } ion-content { + // content within the user created view, contained by .nav-item position: absolute; top: 0; left: 0; @@ -94,6 +88,7 @@ ion-app { } .scroll-content { + // extra div to allow overflow scrolling position: absolute; top: 0; right: 0; diff --git a/ionic/components/nav/test/basic/pages/first-page.html b/ionic/components/nav/test/basic/pages/first-page.html index ac4a0a9d41..fca86e4dd5 100644 --- a/ionic/components/nav/test/basic/pages/first-page.html +++ b/ionic/components/nav/test/basic/pages/first-page.html @@ -1,14 +1,14 @@ -
+ -

First Page: Instance {{ val }}

+ First Page: {{ val }} -
+ -

First Page: Instance {{ val }}

+

First Page: {{ val }}

diff --git a/ionic/components/nav/test/basic/pages/first-page.js b/ionic/components/nav/test/basic/pages/first-page.js index 1574c21036..2e8c5ffa78 100644 --- a/ionic/components/nav/test/basic/pages/first-page.js +++ b/ionic/components/nav/test/basic/pages/first-page.js @@ -1,14 +1,14 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; -import {NavController, Header} from 'ionic/ionic'; +import {NavController, Header, Toolbar, ToolbarTitle} from 'ionic/ionic'; import {SecondPage} from './second-page'; @Component({selector: 'ion-view'}) @View({ templateUrl: 'pages/first-page.html', - directives: [Header] + directives: [Header, ToolbarTitle, Toolbar] }) export class FirstPage { constructor( diff --git a/ionic/components/nav/test/basic/pages/second-page.html b/ionic/components/nav/test/basic/pages/second-page.html index ba95be0e3a..26d242cd06 100644 --- a/ionic/components/nav/test/basic/pages/second-page.html +++ b/ionic/components/nav/test/basic/pages/second-page.html @@ -1,9 +1,9 @@ -

+ -

Second Page

+ Second Page -
+ diff --git a/ionic/components/nav/test/basic/pages/second-page.js b/ionic/components/nav/test/basic/pages/second-page.js index 0f44ae9092..5f8136a4ad 100644 --- a/ionic/components/nav/test/basic/pages/second-page.js +++ b/ionic/components/nav/test/basic/pages/second-page.js @@ -1,14 +1,14 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; -import {NavController, NavParams, Header} from 'ionic/ionic'; +import {NavController, NavParams, Header, ToolbarTitle, Toolbar} from 'ionic/ionic'; import {ThirdPage} from './third-page'; @Component() @View({ templateUrl: 'pages/second-page.html', - directives: [Header] + directives: [Header, ToolbarTitle, Toolbar] }) export class SecondPage { constructor( diff --git a/ionic/components/nav/test/basic/pages/third-page.html b/ionic/components/nav/test/basic/pages/third-page.html index c2be75dd4c..34add5c111 100644 --- a/ionic/components/nav/test/basic/pages/third-page.html +++ b/ionic/components/nav/test/basic/pages/third-page.html @@ -1,9 +1,9 @@ -
+ -

Third Page

+ Third Page -
+ diff --git a/ionic/components/nav/test/basic/pages/third-page.js b/ionic/components/nav/test/basic/pages/third-page.js index 559c98a198..8b9d66eae8 100644 --- a/ionic/components/nav/test/basic/pages/third-page.js +++ b/ionic/components/nav/test/basic/pages/third-page.js @@ -1,13 +1,13 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; -import {NavController, Header} from 'ionic/ionic'; +import {NavController, Header, ToolbarTitle, Toolbar} from 'ionic/ionic'; @Component() @View({ templateUrl: 'pages/third-page.html', - directives: [Header] + directives: [Header, ToolbarTitle, Toolbar] }) export class ThirdPage { constructor( diff --git a/ionic/components/toolbar/toolbar.js b/ionic/components/toolbar/toolbar.js index f6d1cadea6..2a9a82868e 100644 --- a/ionic/components/toolbar/toolbar.js +++ b/ionic/components/toolbar/toolbar.js @@ -1,4 +1,5 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; +import {View} from 'angular2/src/core/annotations_impl/view'; import {ElementRef} from 'angular2/src/core/compiler/element_ref'; import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref'; @@ -8,20 +9,21 @@ import {NavItem} from 'ionic/ionic'; import {Platform} from 'ionic/platform/platform'; -@Directive({ - selector: '[ion-header]' +@Component({ + selector: 'ion-toolbar' }) -export class Header { - - constructor(navItem: NavItem, protoViewRef: ProtoViewRef) { - navItem.addHeader(protoViewRef); +@View({ + template: `` +}) +export class Toolbar { + constructor() { + console.log('ion-toolbar'); } - } @Component({ - selector: '.toolbar-title' + selector: 'ion-title' }) @View({ template: ` @@ -30,9 +32,8 @@ export class Header { ` }) export class ToolbarTitle { - constructor( - element: ElementRef - ) { + constructor(element: ElementRef) { + console.log('ion-title'); // this.domElement = element.domElement; // // TODO find better way to get parent toolbar @@ -84,3 +85,18 @@ export class ToolbarTitle { } } + + +/* + Used to find and register headers in a view, and this directive's + content will be moved up to the common toolbar location, and created + using the same context as the view's content area. +*/ +@Directive({ + selector: 'template[header]' +}) +export class Header { + constructor(navItem: NavItem, protoViewRef: ProtoViewRef) { + navItem.addHeader(protoViewRef); + } +}