Revisions: Cleanup, bug fixes, refactoring, polish.

* Hide the tooltip initially.
* Fix a bug with routing.
* Further separate the Slider model and view, refactoring its code.
* More reliance on events than direct calls between areas.
* Smarter background diff loading (single mode). Loads the diffs closest to your position first.
* Removed a bunch of manual templating and `render()` methods. Now relies more on the WP Backbone Views functionality.
* include the requested `id` in `ensure:load`.
* new trigger: `ensure`, for `ensure()` attempts, regardless of whether they are already loaded.
* pass along a promise in both `ensure` and `ensure:load`.
* in `ensure`, remove requests for diffs we aready have

See #24425.

git-svn-id: http://core.svn.wordpress.org/trunk@24671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith
2013-07-12 14:01:39 +00:00
parent 7cf1702442
commit e8b9088c5f
4 changed files with 124 additions and 181 deletions

View File

@@ -99,10 +99,13 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
}
// Now, grab the initial diff
$compare_two_mode = (bool) $from;
if ( ! $from ) // Single mode
$compare_two_mode = is_numeric( $from );
if ( ! $compare_two_mode ) {
$from = array_keys( array_slice( $revisions, array_search( $selected_revision_id, array_keys( $revisions ) ) - 1, 1, true ) );
$from = $from[0];
}
$from = absint( $from );
$diffs = array( array(
'id' => $from . ':' . $selected_revision_id,