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

Commit

Permalink
Navigation: Factor out transition determination logic, reuse for dialog
Browse files Browse the repository at this point in the history
Fxies gh-4951
  • Loading branch information
Gabriel Schulhof committed Jun 11, 2014
1 parent 8ff42d3 commit 0e0b5f7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions js/widgets/pagecontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ define( [
return to || this._getInitialContent();
},

_transitionFromHistory: function( direction, defaultTransition ) {
var history = this._getHistory(),
entry = ( direction === "back" ? history.getLast() : history.getActive() );

return ( entry && entry.transition ) || defaultTransition;
},

_handleDialog: function( changePageOptions, data ) {
var to, active, activeContent = this.getActivePage();

Expand All @@ -270,7 +277,9 @@ define( [
// as most of this is lost by the domCache cleaning
$.extend( changePageOptions, {
role: active.role,
transition: active.transition,
transition: this._transitionFromHistory(
data.direction,
changePageOptions.transition ),
reverse: data.direction === "back"
});
}
Expand All @@ -286,8 +295,7 @@ define( [
// transition is false if it's the first page, undefined
// otherwise (and may be overridden by default)
transition = history.stack.length === 0 ? "none" :
( ( data.direction === "back" ? history.getLast() : history.getActive() ) ||
{} ).transition,
this._transitionFromHistory( data.direction ),

// default options for the changPage calls made after examining
// the current state of the page and the hash, NOTE that the
Expand Down

0 comments on commit 0e0b5f7

Please sign in to comment.