Always display the table, with a placeholder row when there are no items. Fixes #15849

git-svn-id: http://svn.automattic.com/wordpress/trunk@17002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-12-16 19:05:14 +00:00
parent 3a66c698ee
commit 5fce5c6d14
8 changed files with 41 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -425,6 +425,10 @@ ol.ol-decimal > li {
font-size: 11px; font-size: 11px;
} }
.widefat .no-items td {
border-bottom-width: 0;
}
.widefat td { .widefat td {
padding: 3px 7px; padding: 3px 7px;
vertical-align: top; vertical-align: top;

View File

@ -253,7 +253,7 @@ endif; ?>
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
<?php $wp_list_table->display_table(); ?> <?php $wp_list_table->display(); ?>
<br class="clear" /> <br class="clear" />
</form> </form>

View File

@ -253,7 +253,7 @@ class WP_Comments_List_Table extends WP_List_Table {
); );
} }
function display_table() { function display() {
extract( $this->_args ); extract( $this->_args );
$this->display_tablenav( 'top' ); $this->display_tablenav( 'top' );

View File

@ -647,41 +647,12 @@ class WP_List_Table {
} }
/** /**
* Display the table or a message if there are no items * Display the table
* *
* @since 3.1.0 * @since 3.1.0
* @access public * @access public
*/ */
function display() { function display() {
if ( $this->has_items() ) {
$this->display_table();
} else {
?>
<br class="clear" />
<p><?php $this->no_items(); ?></p>
<?php
}
}
/**
* Get a list of CSS classes for the <table> tag
*
* @since 3.1.0
* @access protected
*
* @return array
*/
function get_table_classes() {
return array( 'widefat', 'fixed', $this->_args['plural'] );
}
/**
* Display the full table
*
* @since 3.1.0
* @access public
*/
function display_table() {
extract( $this->_args ); extract( $this->_args );
$this->display_tablenav( 'top' ); $this->display_tablenav( 'top' );
@ -701,14 +672,25 @@ class WP_List_Table {
</tfoot> </tfoot>
<tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>> <tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
<?php $this->display_rows(); ?> <?php $this->display_rows_or_placeholder(); ?>
</tbody> </tbody>
</table> </table>
<?php <?php
$this->display_tablenav( 'bottom' ); $this->display_tablenav( 'bottom' );
} }
/**
* Get a list of CSS classes for the <table> tag
*
* @since 3.1.0
* @access protected
*
* @return array
*/
function get_table_classes() {
return array( 'widefat', 'fixed', $this->_args['plural'] );
}
/** /**
* Generate the table navigation above or below the table * Generate the table navigation above or below the table
* *
@ -749,6 +731,22 @@ class WP_List_Table {
* @since 3.1.0 * @since 3.1.0
* @access protected * @access protected
*/ */
function display_rows_or_placeholder() {
if ( $this->has_items() ) {
$this->display_rows();
} else {
echo '<tr class="no-items"><td colspan="2">';
$this->no_items();
echo '</td></tr>';
}
}
/**
* Generate the table rows
*
* @since 3.1.0
* @access protected
*/
function display_rows() { function display_rows() {
foreach ( $this->items as $item ) foreach ( $this->items as $item )
$this->single_row( $item ); $this->single_row( $item );
@ -822,7 +820,7 @@ class WP_List_Table {
extract( $this->_pagination_args ); extract( $this->_pagination_args );
ob_start(); ob_start();
$this->display_rows(); $this->display_rows_or_placeholder();
$rows = ob_get_clean(); $rows = ob_get_clean();
$response = array( 'rows' => $rows ); $response = array( 'rows' => $rows );

View File

@ -125,7 +125,7 @@ class WP_Theme_Install_List_Table extends WP_List_Table {
return array(); return array();
} }
function display_table() { function display() {
?> ?>
<div class="tablenav"> <div class="tablenav">
<div class="alignleft actions"> <div class="alignleft actions">

View File

@ -83,7 +83,7 @@ class WP_Themes_List_Table extends WP_List_Table {
printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) ); printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) );
} }
function display_table() { function display() {
?> ?>
<div class="tablenav"> <div class="tablenav">
<?php $this->pagination( 'top' ); ?> <?php $this->pagination( 'top' ); ?>

View File

@ -501,7 +501,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version ); $styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version );
$styles->add( 'ms', "/wp-admin/css/ms$suffix.css", array(), '20101213' ); $styles->add( 'ms', "/wp-admin/css/ms$suffix.css", array(), '20101213' );
$styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20101105' ); $styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20101216' );
$styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20101020' ); $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20101020' );
$styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20100610' ); $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20100610' );
$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20101215' ); $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20101215' );