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,33 +395,41 @@ 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'>";
|
||||
$plugin_meta = array();
|
||||
if ( !empty( $plugin_data['Version'] ) )
|
||||
$plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
|
||||
if ( !empty( $plugin_data['Author'] ) ) {
|
||||
$author = $plugin_data['Author'];
|
||||
if ( !empty( $plugin_data['AuthorURI'] ) )
|
||||
$author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
|
||||
$plugin_meta[] = sprintf( __( 'By %s' ), $author );
|
||||
}
|
||||
if ( ! empty( $plugin_data['PluginURI'] ) )
|
||||
$plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __( 'Visit plugin site' ) . '</a>';
|
||||
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'] );
|
||||
if ( !empty( $plugin_data['Author'] ) ) {
|
||||
$author = $plugin_data['Author'];
|
||||
if ( !empty( $plugin_data['AuthorURI'] ) )
|
||||
$author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
|
||||
$plugin_meta[] = sprintf( __( 'By %s' ), $author );
|
||||
}
|
||||
if ( ! empty( $plugin_data['PluginURI'] ) )
|
||||
$plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __( 'Visit plugin site' ) . '</a>';
|
||||
|
||||
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
|
||||
echo implode( ' | ', $plugin_meta );
|
||||
|
||||
$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,17 +123,22 @@ $(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();
|
||||
|
|
|
@ -65,7 +65,7 @@ window.listTable = {
|
|||
data = $.query.get();
|
||||
|
||||
this._callback = callback;
|
||||
|
||||
|
||||
this.fetch_list(
|
||||
data,
|
||||
$.proxy(this, 'handle_success'),
|
||||
|
@ -107,6 +107,8 @@ window.listTable = {
|
|||
$('.current-page').val($.query.GET('paged'));
|
||||
|
||||
$('th.column-cb :input').attr('checked', false);
|
||||
|
||||
columns.init(); // To rehide the hidden columns.
|
||||
|
||||
if ( this._callback )
|
||||
this._callback();
|
||||
|
|
Loading…
Reference in New Issue