Make WordPress Core

Changeset 24606


Ignore:
Timestamp:
07/09/2013 08:14:38 AM (11 years ago)
Author:
koopersmith
Message:

Revisions: Simplify how URLs are updated. See #24425.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/revisions.js

    r24605 r24606  
    413413
    414414            // Update route
    415             this.model.revisionsRouter.navigateRoute( this.model.get('to').id, this.model.get('from').id );
     415            this.model.revisionsRouter.updateUrl();
    416416        },
    417417
     
    499499
    500500            // Update route
    501             this.model.revisionsRouter.navigateRoute( attributes.to.id, attributes.from ? attributes.from.id : 0 );
     501            this.model.revisionsRouter.updateUrl();
    502502        },
    503503
     
    797797
    798798            // Maintain state history when dragging
    799             this.listenTo( this.model, 'renderDiff', this.updateURL );
     799            this.listenTo( this.model, 'renderDiff', _.debounce( this.updateUrl, 250 ) );
    800800        },
    801801
     
    804804        },
    805805
    806         navigateRoute: function( to, from ) {
    807             var navigateTo = '/revision/from/' + from + '/to/' + to + '/handles/';
    808             if ( this.model.get('compareTwoMode') ) {
    809                 navigateTo += '2';
    810             } else {
    811                 navigateTo += '1';
    812             }
    813             this.navigate( navigateTo );
    814         },
    815 
    816         updateURL: _.debounce( function() {
    817             var from = this.model.get('from');
    818             this.navigateRoute( this.model.get('to').id, from ? from.id : 0 );
    819         }, 250 ),
     806        updateUrl: function() {
     807            var from = this.model.has('from') ? this.model.get('from').id : 0;
     808            var to = this.model.get('to').id;
     809            var handles = this.model.get('compareTwoMode') ? '2' : '1';
     810
     811            this.navigate( '/revision/from/' + from + '/to/' + to + '/handles/' + handles );
     812        },
    820813
    821814        gotoRevisionId: function( from, to, handles ) {
Note: See TracChangeset for help on using the changeset viewer.