Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
- adicao navegacao backbutton com modal, closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonornela committed Mar 21, 2016
1 parent dbba4fb commit 93aeca1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Ext.define('Mba.ux.Viewport.Navigation', {
view = Ext.Viewport.add({xtype: viewXtype});
}

if(!animation && view.getAnimation) {
if(!animation && Ext.isFunction(view.getAnimation)) {
animation = view.getAnimation();
animation.direction = 'left';
}
Expand Down Expand Up @@ -138,15 +138,23 @@ Ext.define('Mba.ux.Viewport.Navigation', {
*/
back: function() {
var stack = this.getNavigationStack(),
xtype, animation;
view, xtype, animation;

this.clearAutoNavigation(stack[stack.length-1]);

if (stack.length <= 1) {
return false;
}

animation = this.getAnimation(stack.pop());
xtype = stack.pop();
view = Ext.Viewport.child(xtype);

if (!view.isInnerItem()) {
view.hide();
return true;
}

animation = this.getAnimation(view);

if (animation) {
animation.direction = 'right';
Expand Down Expand Up @@ -184,8 +192,10 @@ Ext.define('Mba.ux.Viewport.Navigation', {
* @param {xtype} viewXtype
* @returns {Object}
*/
getAnimation: function(viewXtype) {
var view = Ext.Viewport.child(viewXtype);
getAnimation: function(view) {
if (typeof view === 'string') {
view = Ext.Viewport.child(viewXtype);
}

return view.getAnimation ? view.getAnimation() : null;
},
Expand Down
13 changes: 13 additions & 0 deletions viewport/Default.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ Ext.define('Mba.ux.viewport.Default', {
}
},

/**
* @inheritdoc
*/
add: function() {
var item = this.callOverridden(arguments);

if (!item.isInnerItem()) {
this.getNavigation().orderHistory(item.xtype);
}

return item;
},

/**
* @private
*/
Expand Down

0 comments on commit 93aeca1

Please sign in to comment.