Disabled states for first/prev and next/last pagination buttons when they should noop. see #15503.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-01-01 23:19:26 +00:00
parent f15b1ad05d
commit e8d5e62d1b
5 changed files with 38 additions and 14 deletions

View File

@ -1400,17 +1400,19 @@ body.press-this .stuffbox:hover .handlediv,
}
.tablenav .tablenav-pages a {
border-color: #D1E5EE;
border-color: #d1e5ee;
background: #eee url('../images/menu-bits-vs.gif?ver=20101102') repeat-x scroll left -379px;
}
.tablenav .tablenav-pages a:hover {
.tablenav .tablenav-pages a:hover,
.tablenav .tablenav-pages a:focus {
color: #d54e21;
border-color: #d54321;
}
.tablenav .tablenav-pages a:active {
color: #fff !important;
.tablenav .tablenav-pages a.disabled,
.tablenav .tablenav-pages a.disabled:hover,
.tablenav .tablenav-pages a.disabled:focus {
color: #aaa;
}
.tablenav .tablenav-pages .current {

View File

@ -1399,13 +1399,15 @@ fieldset.inline-edit-col-right .inline-edit-col {
background: #eee url('../images/menu-bits.gif?ver=20100610') repeat-x scroll left -379px;
}
.tablenav .tablenav-pages a:hover {
.tablenav .tablenav-pages a:hover,
.tablenav .tablenav-pages a:focus {
color: #d54e21;
border-color: #d54321;
}
.tablenav .tablenav-pages a:active {
color: #fff !important;
.tablenav .tablenav-pages a.disabled,
.tablenav .tablenav-pages a.disabled:hover,
.tablenav .tablenav-pages a.disabled:focus {
color: #aaa;
}
.tablenav .tablenav-pages .current {

View File

@ -1493,6 +1493,14 @@ th.asc:hover span.sorting-indicator {
border-radius: 5px;
}
.tablenav .tablenav-pages a.disabled:hover {
cursor: default;
}
.tablenav .tablenav-pages a.disabled:active {
cursor: default;
}
.tablenav .displaying-num {
margin-right: 10px;
font-size: 12px;

View File

@ -480,15 +480,21 @@ class WP_List_Table {
$page_links = array();
$disable_first = $disable_last = '';
if ( $current == 1 )
$disable_first = ' disabled';
if ( $current == $total_items )
$disable_last = ' disabled';
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
'first-page',
'first-page' . $disable_first,
esc_attr__( 'Go to the first page' ),
esc_url( remove_query_arg( 'paged', $current_url ) ),
'&laquo;'
);
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
'prev-page',
'prev-page' . $disable_first,
esc_attr__( 'Go to the previous page' ),
esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
'&lsaquo;'
@ -504,14 +510,14 @@ class WP_List_Table {
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
'next-page',
'next-page' . $disable_last,
esc_attr__( 'Go to the next page' ),
esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
'&rsaquo;'
);
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
'last-page',
'last-page' . $disable_last,
esc_attr__( 'Go to the last page' ),
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
'&raquo;'

View File

@ -91,6 +91,8 @@ window.listTable = {
if ( 'object' != typeof response ) {
this.handle_error();
} else {
var tablenav = $('.tablenav-pages');
this.stop_loading();
$('div.updated, div.error').not('.persistent, .inline').remove();
@ -103,10 +105,14 @@ window.listTable = {
this.set_total_pages(response.total_pages);
if ( response.total_pages > 1 )
$('.tablenav-pages').removeClass('one-page');
tablenav.removeClass('one-page');
$('.current-page').val($.query.GET('paged'));
// Disable buttons that should noop.
tablenav.find('.first-page, .prev-page').toggleClass('disabled', 1 == $.query.GET('paged'));
tablenav.find('.next-page, .last-page').toggleClass('disabled', response.total_pages_i18n == $.query.GET('paged'));
$('th.column-cb :input').attr('checked', false);
if ( history.replaceState ) {