Changeset 24556
- Timestamp:
- 07/04/2013 08:30:36 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/revisions.js
r24549 r24556 196 196 this.listenTo( this, 'change:from', this.updateDiffFrom ); 197 197 this.listenTo( this, 'change:to', this.updateDiffTo ); 198 this.revisionsRouter = new revisions.router.Router(); 199 this.revisionsRouter.model = this; 198 this.revisionsRouter = new revisions.router.Router({ model: this }); 200 199 }, 201 200 202 201 updateDiffTo: function() { 203 202 var from = this.get( 'from' ); 204 var to = this.get( 'to' ); 205 this.set( 'diffId', (from ? from.id : '0' ) + ':' + to.id ); 203 this.set( 'diffId', (from ? from.id : '0' ) + ':' + this.get('to').id ); 206 204 }, 207 205 … … 269 267 model: diff 270 268 })); 269 this.model.trigger( 'renderDiff' ); 271 270 }); 272 271 } … … 685 684 } 686 685 this.model.set( attributes ); 687 688 // Maintain state history when dragging689 this.model.revisionsRouter.navigateRoute( attributes.to.id, ( attributes.from ? attributes.from.id : 0 ) );690 686 }, 691 687 … … 718 714 // takes URLs with #hash fragments and routes them 719 715 revisions.router.Router = Backbone.Router.extend({ 720 model: null, 716 initialize: function( options ) { 717 this.model = options.model; 718 719 // Maintain state history when dragging 720 this.listenTo( this.model, 'renderDiff', this.updateURL ); 721 }, 721 722 722 723 routes: { … … 733 734 this.navigate( navigateTo ); 734 735 }, 736 737 updateURL: _.debounce( function() { 738 var from = this.model.get('from'); 739 this.navigateRoute( this.model.get('to').id, from ? from.id : 0 ); 740 }, 250 ), 735 741 736 742 gotoRevisionId: function( from, to, handles ) {
Note: See TracChangeset
for help on using the changeset viewer.