Fix pagination when searching or filtering, props solarissmoke, koopersmith, fixes #17685

git-svn-id: http://svn.automattic.com/wordpress/trunk@18237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-06-10 19:33:45 +00:00
parent 3b4443b140
commit 692bc46e6c
3 changed files with 14 additions and 3 deletions

View File

@ -228,7 +228,8 @@ screenMeta = {
}; };
$(document).ready( function() { $(document).ready( function() {
var lastClicked = false, checks, first, last, checked, dropdown; var lastClicked = false, checks, first, last, checked, dropdown,
pageInput = $('input[name="paged"]'), currentPage;
// Move .updated and .error alert boxes. Don't move boxes designed to be inline. // Move .updated and .error alert boxes. Don't move boxes designed to be inline.
$('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2');
@ -343,6 +344,16 @@ $(document).ready( function() {
if ( this.lastKey && 9 == this.lastKey ) if ( this.lastKey && 9 == this.lastKey )
this.focus(); this.focus();
}); });
if ( pageInput.length ) {
currentPage = pageInput.val();
pageInput.closest('form').submit( function(){
// Reset paging var for new filters/searches. See #17685.
if ( pageInput.val() == currentPage )
pageInput.val('1');
});
}
}); });
// internal use // internal use

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' ); $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110606' ); $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110610' );
$scripts->add_data( 'common', 'group', 1 ); $scripts->add_data( 'common', 'group', 1 );
$scripts->localize( 'common', 'commonL10n', array( $scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),