~ubuntu-branches/debian/jessie/wordpress/jessie

« back to all changes in this revision

Viewing changes to wp-admin/js/revisions.js

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-04-17 20:56:19 UTC
  • mfrom: (1.2.35)
  • Revision ID: package-import@ubuntu.com-20140417205619-nurbet6eho4yvwfv
Tags: 3.9+dfsg-1
* New upstream release
* 3.9 seems to handle different locations for plugins so the
  plugin directory handling patches have been cut back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1048
1048
                }
1049
1049
        });
1050
1050
 
1051
 
        // The revisions router
1052
 
        // takes URLs with #hash fragments and routes them
 
1051
        // The revisions router.
 
1052
        // Maintains the URL routes so browser URL matches state.
1053
1053
        revisions.Router = Backbone.Router.extend({
1054
1054
                initialize: function( options ) {
1055
1055
                        this.model = options.model;
1056
 
                        this.routes = _.object([
1057
 
                                [ this.baseUrl( '?from=:from&to=:to' ), 'handleRoute' ],
1058
 
                                [ this.baseUrl( '?from=:from&to=:to' ), 'handleRoute' ]
1059
 
                        ]);
 
1056
 
1060
1057
                        // Maintain state and history when navigating
1061
1058
                        this.listenTo( this.model, 'update:diff', _.debounce( this.updateUrl, 250 ) );
1062
1059
                        this.listenTo( this.model, 'change:compareTwoMode', this.updateUrl );
1070
1067
                        var from = this.model.has('from') ? this.model.get('from').id : 0,
1071
1068
                                to   = this.model.get('to').id;
1072
1069
                        if ( this.model.get('compareTwoMode' ) ) {
1073
 
                                this.navigate( this.baseUrl( '?from=' + from + '&to=' + to ) );
 
1070
                                this.navigate( this.baseUrl( '?from=' + from + '&to=' + to ), { replace: true } );
1074
1071
                        } else {
1075
 
                                this.navigate( this.baseUrl( '?revision=' + to ) );
 
1072
                                this.navigate( this.baseUrl( '?revision=' + to ), { replace: true } );
1076
1073
                        }
1077
1074
                },
1078
1075
 
1085
1082
                                b = b ? b.id : 0;
1086
1083
                                a = a ? a.id : 0;
1087
1084
                        }
1088
 
 
1089
 
                        this.model.set({
1090
 
                                from: this.model.revisions.get( parseInt( a, 10 ) ),
1091
 
                                to: this.model.revisions.get( parseInt( a, 10 ) ),
1092
 
                                compareTwoMode: compareTwo
1093
 
                        });
1094
1085
                }
1095
1086
        });
1096
1087