Skip to content
3 changes: 2 additions & 1 deletion components/ionContent/ionContent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
ionic-scroll
{{#unless scroll}} scroll-content-false {{/unless}}
{{#if hasHeader}}has-header{{/if}}
{{#if hasFooter}}has-footer{{/if}}">
{{#if hasFooter}}has-footer{{/if}}
{{class}}">
{{#if scroll}}
<div class="scroll">
{{> Template.contentBlock}}
Expand Down
7 changes: 6 additions & 1 deletion components/ionHeaderBar/ionHeaderBar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template name="ionHeaderBar">
<div class="bar bar-header {{classes}}">
{{#if isIronRouter}}
<div class="buttons">{{> yield "headerButtonLeft"}}</div>
<div class="title">{{> yield "headerTitle"}}</div>
{{> yield "headerTitle"}}
<div class="buttons">{{> yield "headerButtonRight"}}</div>
{{/if}}
{{#if isFlowRouter}}
{{> Template.dynamic template=navBarTemplateName data=navBarData}}
{{/if}}
</div>
</template>
6 changes: 6 additions & 0 deletions components/ionHeaderBar/ionHeaderBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@ Template.ionHeaderBar.helpers({
}

return classes.join(' ');
},
isFlowRouter: function() {
return ('flow-router' === RouterLayer.router)
},
isIronRouter: function() {
return ('iron-router' === RouterLayer.router)
}
});
16 changes: 8 additions & 8 deletions components/ionNavBackButton/ionNavBackButton.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
IonScrollPositions = {};

Router.onStop(function () {
IonScrollPositions[this.route.path(this.params)] = $('.overflow-scroll').scrollTop();
});
// TODO: Add Routing-Agnostic scroll-to-top - method

//RouterLayer.onStop(function () {
// IonScrollPositions[this.route.path(this.params)] = $('.overflow-scroll').scrollTop();
//});

Template.ionNavBackButton.events({
'click': function (event, template) {
$('[data-nav-container]').attr('nav-view-direction', 'back');
$('[data-navbar-container]').attr('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();
}
Expand All @@ -35,7 +35,7 @@ Template.ionNavBackButton.onRendered(function () {
}

if (self.data.path) {
backRoute = Router.routes[self.data.path];
backRoute = RouterLayer.routes[self.data.path];
if (!backRoute) {
console.warn("back to nonexistent route: ", self.data.path);
return;
Expand Down
5 changes: 5 additions & 0 deletions components/ionNavBar/ionNavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Template.ionNavBar.onCreated(function() {
this.transition = 'ios';
}

// Allow overriding the transition
if (this.data.transition) {
this.transition = this.data.transition;
}

this.ionNavBarTemplate = new ReactiveVar('_ionNavBar');

$(window).on('statechange', e => this.ionNavBarTemplate.set(''));
Expand Down
6 changes: 3 additions & 3 deletions components/ionTab/ionTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Template.ionTab.helpers({
return this.href;
}

if (this.path && Router.routes[this.path]) {
return Router.routes[this.path].path(Template.currentData());
if (this.path && RouterLayer.routes[this.path]) {
return RouterLayer.routes[this.path].path(Template.currentData());
}
},

Expand All @@ -42,7 +42,7 @@ Template.ionTab.helpers({
// 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];
var route = RouterLayer.routes[this.path];
if(route && route.path(Template.currentData()) === ionTabCurrent){
return 'active';
}
Expand Down
2 changes: 1 addition & 1 deletion components/ionView/ionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Template.ionView.onRendered(function () {
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];
Expand Down
11 changes: 7 additions & 4 deletions lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ _.extend(window.meteoric.Utils, {
}
});

Router.onBeforeAction(function() {
$(window).trigger('statechange');
this.next();
});
// I hope this works equivalent to IronRouters' Router.onBeforeAction()
Meteor.startup(function(){
Tracker.autorun(function() {
RouterLayer.getPath();
$(window).trigger('statechange');
});
});
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Package.onUse(function (api) {
"reactive-var",
"reactive-dict",
"fastclick",
"iron:router@1.0.0",
"nicolaslopezj:router-layer@0.0.11",
"tracker",
"session",
"jquery",
Expand Down
2 changes: 1 addition & 1 deletion styles/_transitions.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '{jandres:meteoric-sass}/scss/_mixins.scss';
@import '{jandres:meteoric-sass}/scss/_variables.scss';

[nav-view-transition] {
[nav-view-transition]:not([nav-view-transition=none]) {
/**
* Transition states:
* 1. stage: Set the initial position of the not yet existent view.
Expand Down
Loading