mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-06-30 06:12:08 -06:00
dont run route animations when changing tabs
This commit is contained in:
parent
5642e3ff92
commit
99214b4036
6 changed files with 34 additions and 6 deletions
|
|
@ -28,7 +28,7 @@ Template.ionNavBar.rendered = function () {
|
|||
insertElement: function(node, next) {
|
||||
var $node = $(node);
|
||||
|
||||
if (!$node.hasClass('title') && !$node.hasClass('button')) {
|
||||
if (!$node.hasClass('title') && !$node.hasClass('button') || IonNavigation.skipTransitions) {
|
||||
$node.insertBefore(next);
|
||||
return;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ Template.ionNavBar.rendered = function () {
|
|||
|
||||
removeElement: function(node) {
|
||||
var $node = $(node);
|
||||
if (!$node.hasClass('title') && !$node.hasClass('button')) {
|
||||
if (!$node.hasClass('title') && !$node.hasClass('button') || IonNavigation.skipTransitions) {
|
||||
$node.remove();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
IonNavigation = {
|
||||
skipTransitions: false
|
||||
};
|
||||
|
||||
Template.ionNavView.created = function () {
|
||||
Session.setDefault('ionNavDirection', 'forward');
|
||||
|
||||
|
|
@ -25,7 +29,7 @@ Template.ionNavView.rendered = function () {
|
|||
this.find('[data-nav-container]')._uihooks = {
|
||||
insertElement: function(node, next) {
|
||||
var $node = $(node);
|
||||
if (!template.transition || !$node.hasClass('view')) {
|
||||
if (!template.transition || !$node.hasClass('view') || IonNavigation.skipTransitions) {
|
||||
$node.insertBefore(next);
|
||||
return;
|
||||
}
|
||||
|
|
@ -43,7 +47,7 @@ Template.ionNavView.rendered = function () {
|
|||
|
||||
removeElement: function(node) {
|
||||
var $node = $(node);
|
||||
if (!template.transition || !$node.hasClass('view')) {
|
||||
if (!template.transition || !$node.hasClass('view') || IonNavigation.skipTransitions) {
|
||||
$node.remove();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template name="ionTab">
|
||||
<a class="tab-item tab-item-positive {{isActiveRoute regex=path}}" href="{{url}}">
|
||||
{{#if isActiveRoute regex=path }}
|
||||
<a class="tab-item tab-item-positive {{isActive}}" href="{{url}}" data-ion-tab>
|
||||
{{#if isActive}}
|
||||
{{> ionIcon icon=activeIcon}}
|
||||
{{else}}
|
||||
{{> ionIcon icon=defaultIcon}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
Template.ionTab.events({
|
||||
'click': function (event, template) {
|
||||
if (template.data.path) {
|
||||
Session.set('currentTab', 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;
|
||||
}
|
||||
});
|
||||
|
||||
Template.ionTab.helpers({
|
||||
url: function () {
|
||||
if (this.href) {
|
||||
|
|
@ -9,6 +21,12 @@ Template.ionTab.helpers({
|
|||
}
|
||||
},
|
||||
|
||||
isActive: function () {
|
||||
if (this.path && this.path === Session.get('currentTab')) {
|
||||
return 'active';
|
||||
}
|
||||
},
|
||||
|
||||
activeIcon: function () {
|
||||
if (this.iconOn) {
|
||||
return this.iconOn;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
Template.ionView.rendered = function () {
|
||||
// Reset our transition preference
|
||||
IonNavigation.skipTransitions = false;
|
||||
};
|
||||
|
||||
Template.ionView.helpers({
|
||||
classes: function () {
|
||||
var classes = ['view'];
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ Package.onUse(function(api) {
|
|||
api.export("IonHeaderBar");
|
||||
api.export("IonLoading");
|
||||
api.export("IonModal");
|
||||
api.export("IonNavigation");
|
||||
api.export("IonPopover");
|
||||
api.export("IonPopup");
|
||||
api.export("IonSideMenu");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue