Begin rework of plugins list table. Props edward mindreantre. See #15318
git-svn-id: http://svn.automattic.com/wordpress/trunk@16345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4b927768fd
commit
bdbfca56a7
|
@ -383,7 +383,8 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
|
||||
|
||||
$class = $is_active ? 'active' : 'inactive';
|
||||
$checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' />";
|
||||
$checkbox_id = md5($plugin_data['Name']) . "_checkbox";
|
||||
$checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $plugin_data['Name'] . "</label>";
|
||||
if ( 'dropins' != $status ) {
|
||||
$description = '<p>' . $plugin_data['Description'] . '</p>';
|
||||
$plugin_name = $plugin_data['Name'];
|
||||
|
@ -394,17 +395,21 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
echo "
|
||||
<tr id='$id' class='$class'>
|
||||
<th scope='row' class='check-column'>$checkbox</th>
|
||||
<td class='plugin-title'><strong>$plugin_name</strong></td>
|
||||
<td class='desc'>$description</td>
|
||||
</tr>
|
||||
<tr class='$class second'>
|
||||
<td></td>
|
||||
<td class='plugin-title'>";
|
||||
<td class='plugin-title'>
|
||||
<strong>$plugin_name</strong>
|
||||
";
|
||||
|
||||
echo $this->row_actions( $actions, true );
|
||||
|
||||
echo "</td>
|
||||
<td class='desc'>";
|
||||
echo "
|
||||
</td>
|
||||
<td class='column-description desc'>
|
||||
<div class='plugin-description'>
|
||||
$description
|
||||
</div>
|
||||
<div class='$class second plugin-version-author-uri'>
|
||||
";
|
||||
|
||||
$plugin_meta = array();
|
||||
if ( !empty( $plugin_data['Version'] ) )
|
||||
$plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
|
||||
|
@ -419,8 +424,12 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
|
||||
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
|
||||
echo implode( ' | ', $plugin_meta );
|
||||
echo "</td>
|
||||
</tr>\n";
|
||||
|
||||
echo "
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
|
||||
do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
|
||||
|
|
|
@ -123,18 +123,23 @@ $(document).ready(function(){ adminMenu.init(); });
|
|||
// show/hide/save table columns
|
||||
columns = {
|
||||
init : function() {
|
||||
var that = this;
|
||||
$('.hide-column-tog', '#adv-settings').click( function() {
|
||||
var $t = $(this), column = $t.val();
|
||||
if ( $t.attr('checked') )
|
||||
that.checked(column);
|
||||
else
|
||||
that.unchecked(column);
|
||||
|
||||
this.toggleView( $('.hide-column-tog', '#adv-settings').attr('checked'), $('.hide-column-tog', '#adv-settings').val() );
|
||||
$('.column-name').css("width", "auto"); // Otherwise it only wants 50% column width...
|
||||
|
||||
$('.hide-column-tog', '#adv-settings').click( function() {
|
||||
columns.toggleView( $(this).attr('checked'), $(this).val() );
|
||||
columns.saveManageColumnsState();
|
||||
});
|
||||
},
|
||||
|
||||
toggleView : function(checked, column) {
|
||||
if ( checked )
|
||||
this.checked(column);
|
||||
else
|
||||
this.unchecked(column);
|
||||
},
|
||||
|
||||
saveManageColumnsState : function() {
|
||||
var hidden = this.hidden();
|
||||
$.post(ajaxurl, {
|
||||
|
|
|
@ -108,6 +108,8 @@ window.listTable = {
|
|||
|
||||
$('th.column-cb :input').attr('checked', false);
|
||||
|
||||
columns.init(); // To rehide the hidden columns.
|
||||
|
||||
if ( this._callback )
|
||||
this._callback();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue