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: http://core.svn.wordpress.org/trunk@24646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-07-10 19:17:01 +00:00
parent 6050f55678
commit b3dbe47b1f
1 changed files with 5 additions and 4 deletions

View File

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