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: https://develop.svn.wordpress.org/trunk@24671 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2013-07-12 14:01:39 +00:00
parent b7e1e25e36
commit 3584dd58a9
4 changed files with 124 additions and 181 deletions
+5 -2
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,