Revisions: fixes for routing and initial setting of compareTwoMode

* Fix routing handler logic (`compareTwoMode` was reversed).
* Fix routing handler typo (both should use the same handler).
* Set `compareTwoMode` to false, to start. props duck_.

See #24425.

git-svn-id: https://develop.svn.wordpress.org/trunk@24646 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2013-07-10 19:17:01 +00:00
parent 792fd2aab9
commit 3fb18a0cc4

View File

@ -248,6 +248,7 @@ window.wp = window.wp || {};
// Set the initial revision provided through the settings.
properties.to = this.revisions.get( revisions.settings.selectedRevision );
properties.from = this.revisions.prev( properties.to );
properties.compareTwoMode = false;
this.set( properties );
// Start the router. This will trigger a navigate event and ensure that
@ -894,7 +895,7 @@ window.wp = window.wp || {};
routes: {
'from/:from/to/:to': 'handleRoute',
'at/:to': 'routeSingle'
'at/:to': 'handleRoute'
},
updateUrl: function() {
@ -909,13 +910,13 @@ window.wp = window.wp || {};
handleRoute: function( a, b ) {
var from, to, compareTwo;
// If `b` is undefined, this was a 'revision/:to' route
// If `b` is undefined, this is an 'at/:to' route, for a single revision
if ( _.isUndefined( b ) ) {
b = a;
a = 0;
compareTwo = true;
} else {
compareTwo = false;
} else {
compareTwo = true;
}
from = parseInt( a, 10 );