- {{> UI.contentBlock}}
+
+ {{> Template.contentBlock}}
{{/if}}
diff --git a/components/ionItem/ionItem.js b/components/ionItem/ionItem.js
index e0a7644..b1b1b7b 100644
--- a/components/ionItem/ionItem.js
+++ b/components/ionItem/ionItem.js
@@ -72,8 +72,16 @@ Template.ionItem.helpers({
}
} else {
- return Router.routes[path].path(Template.parentData(1));
+ return RouterLayer.getPath(path);
}
}
+ },
+
+ attrs: function() {
+ var ret = {};
+ if (this.id) {
+ ret.id = this.id;
+ }
+ return ret;
}
});
diff --git a/components/ionNavBackButton/ionNavBackButton.js b/components/ionNavBackButton/ionNavBackButton.js
index 086b1a1..6b1257f 100644
--- a/components/ionNavBackButton/ionNavBackButton.js
+++ b/components/ionNavBackButton/ionNavBackButton.js
@@ -1,18 +1,16 @@
IonScrollPositions = {};
-
-Router.onStop(function () {
+/*
+RouterLayer.onStop(function () {
IonScrollPositions[this.route.path(this.params)] = $('.overflow-scroll').scrollTop();
-});
+});*/
Template.ionNavBackButton.events({
'click': function (event, template) {
$('[data-nav-container]').addClass('nav-view-direction-back');
$('[data-navbar-container]').addClass('nav-bar-direction-back');
-
- //get most up-to-date url, if it exists
- backUrl = template.getBackUrl()
- if (backUrl) {
- Router.go(backUrl);
+
+ if (template.backUrl) {
+ RouterLayer.go(template.backUrl);
} else {
window.history.back();
}
@@ -24,14 +22,19 @@ Template.ionNavBackButton.created = function () {
};
Template.ionNavBackButton.rendered = function () {
- var self = this;
- this.getBackUrl = function () {
- var backUrl = null;
+ this.backUrl = null;
- self.data = self.data || {};
-
- if (self.data.href) {
- backUrl = self.data.href;
+ this.data = this.data || {};
+
+ if (this.data.href) {
+ this.backUrl = this.data.href;
+ }
+
+ if (this.data.path) {
+ backRoute = RouterLayer.routes[this.data.path]
+ if (!backRoute) {
+ console.warn("back to nonexistent route: ", this.data.path);
+ return;
}
if (self.data.path) {
diff --git a/components/ionNavBar/ionNavBar.html b/components/ionNavBar/ionNavBar.html
index 220edaf..7b72dd8 100644
--- a/components/ionNavBar/ionNavBar.html
+++ b/components/ionNavBar/ionNavBar.html
@@ -1,7 +1,5 @@
- {{> yield "headerButtonLeft"}}
- {{> yield "headerTitle"}}
- {{> yield "headerButtonRight"}}
+ {{> Template.contentBlock}}
diff --git a/components/ionNavView/ionNavView.js b/components/ionNavView/ionNavView.js
index d42fb64..f8ab1e1 100644
--- a/components/ionNavView/ionNavView.js
+++ b/components/ionNavView/ionNavView.js
@@ -24,7 +24,7 @@ Template.ionNavView.created = function () {
}
};
-Template.ionNavView.rendered = function () {
+Template.ionNavView.onRendered(function () {
var template = this;
var container = this.find('[data-nav-container]');
@@ -66,7 +66,7 @@ Template.ionNavView.rendered = function () {
}, template.transitionDuration);
}
};
-};
+});
Template.ionNavView.helpers({
transition: function () {
diff --git a/components/ionSlideBox/ionSlideBox.html b/components/ionSlideBox/ionSlideBox.html
index 0a6b8c3..822116f 100644
--- a/components/ionSlideBox/ionSlideBox.html
+++ b/components/ionSlideBox/ionSlideBox.html
@@ -1,5 +1,5 @@
- {{> UI.contentBlock}}
+ {{> Template.contentBlock}}
diff --git a/components/ionSubheaderBar/ionSubheaderBar.html b/components/ionSubheaderBar/ionSubheaderBar.html
index f34033c..abd27c9 100644
--- a/components/ionSubheaderBar/ionSubheaderBar.html
+++ b/components/ionSubheaderBar/ionSubheaderBar.html
@@ -1,5 +1,5 @@
- {{> UI.contentBlock}}
+ {{> Template.contentBlock}}
diff --git a/components/ionTab/ionTab.js b/components/ionTab/ionTab.js
index 42ea686..51a0e44 100644
--- a/components/ionTab/ionTab.js
+++ b/components/ionTab/ionTab.js
@@ -1,9 +1,6 @@
Template.ionTab.events({
'click': function (event, template) {
- if (template.data.path) {
- Session.set('ionTab.current', template.data.path);
- }
-
+
// If the tab's content is being rendered inside of a ionNavView
// we don't want to slide it in when switching tabs
IonNavigation.skipTransitions = true;
@@ -26,24 +23,16 @@ Template.ionTab.helpers({
if (this.href) {
return this.href;
}
-
- if (this.path && Router.routes[this.path]) {
- return Router.routes[this.path].path(Template.currentData());
+
+ // kept for backwards compatibility
+ if (this.path) {
+ return this.path;
}
},
isActive: function () {
- var ionTabCurrent = Session.get('ionTab.current');
-
- if (this.path && this.path === ionTabCurrent) {
- return 'active';
- }
-
- // The initial case where there is no localStorage value and
- // no session variable has been set, this attempts to set the correct tab
- // to active based on the router
- var route = Router.routes[this.path];
- if(route && route.path(Template.currentData()) === ionTabCurrent){
+ var route = RouterLayer.getPath(true);
+ if(route === this.path){
return 'active';
}
},
diff --git a/components/ionTabs/ionTabs.js b/components/ionTabs/ionTabs.js
index d0d6c4b..59ea695 100644
--- a/components/ionTabs/ionTabs.js
+++ b/components/ionTabs/ionTabs.js
@@ -1,27 +1,20 @@
-Template.ionTabs.created = function () {
+Template.ionTabs.onCreated(function () {
this.data = this.data || {};
-};
+});
-Template.ionTabs.rendered = function () {
+Template.ionTabs.onRendered(function () {
if ((this.data.class && this.data.class.indexOf('tabs-top') > -1) || this.data.style === 'android' || ( !this.data.style && Platform.isAndroid())) {
Session.set('hasTabsTop', true);
} else {
Session.set('hasTabs', true);
}
+ Session.set('ionTab.current', null);
+});
- this.$('.tabs').children().each(function() {
- var href = $(this).attr('href');
- var current = Router.current().location.get().path;
- if(href === current){
- Session.set('ionTab.current', href);
- }
- });
-};
-
-Template.ionTabs.destroyed = function () {
+Template.ionTabs.onDestroyed(function () {
Session.set('hasTabs', false);
Session.set('hasTabsTop', false);
-};
+});
Template.ionTabs.helpers({
classes: function () {
diff --git a/components/ionView/ionView.html b/components/ionView/ionView.html
index 9ca53cb..ad6b59f 100644
--- a/components/ionView/ionView.html
+++ b/components/ionView/ionView.html
@@ -1,11 +1,10 @@
{{#if title}}
- {{#contentFor "headerTitle"}}
- {{title}}
- {{/contentFor}}
+ {{title}}
+ {{! > headerTitle title=data.title}}
{{/if}}
- {{> UI.contentBlock}}
+ {{> Template.contentBlock}}
-
+
\ No newline at end of file
diff --git a/components/ionView/ionView.js b/components/ionView/ionView.js
index 0466a7a..7f9e948 100644
--- a/components/ionView/ionView.js
+++ b/components/ionView/ionView.js
@@ -1,14 +1,15 @@
-Template.ionView.rendered = function () {
+Template.ionView.onRendered(function () {
// Reset our transition preference
IonNavigation.skipTransitions = false;
// Reset our scroll position
- var routePath = Router.current().route.path(Router.current().params);
+ var routePath = RouterLayer.getPath();
+
if(IonScrollPositions[routePath]) {
$('.overflow-scroll').not('.nav-view-leaving .overflow-scroll').scrollTop(IonScrollPositions[routePath]);
delete IonScrollPositions[routePath];
}
-};
+});
Template.ionView.helpers({
classes: function () {
@@ -19,10 +20,5 @@ Template.ionView.helpers({
}
return classes.join(' ');
- },
- title: function () {
- if ( Template.instance().data && Template.instance().data.title ) {
- return Template.instance().data.title;
- }
}
});
diff --git a/package.js b/package.js
index fe20551..bf9a6f3 100644
--- a/package.js
+++ b/package.js
@@ -11,15 +11,7 @@ Cordova.depends({
Package.onUse(function(api) {
api.versionsFrom("1.0");
- api.use([
- "templating",
- "underscore",
- "fastclick",
- "iron:router@1.0.0",
- "tracker",
- "session",
- "jquery"
- ], "client");
+ api.use(["templating", "underscore", "fastclick", "nicolaslopezj:router-layer@0.0.10", "tracker", "session", "jquery"], "client");
api.addFiles([
"vendor/snap.js",