From bdbfca56a70b0813f63dbfe038fb961b30da39bd Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 13 Nov 2010 15:58:23 +0000 Subject: [PATCH] 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 --- .../includes/class-wp-plugins-list-table.php | 59 +++++++++++-------- wp-admin/js/common.dev.js | 19 +++--- wp-admin/js/list-table.dev.js | 4 +- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 49db1f174f..ff9505ad0e 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -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' ) ) ? '' : ""; + $checkbox_id = md5($plugin_data['Name']) . "_checkbox"; + $checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : ""; if ( 'dropins' != $status ) { $description = '

' . $plugin_data['Description'] . '

'; $plugin_name = $plugin_data['Name']; @@ -394,33 +395,41 @@ class WP_Plugins_List_Table extends WP_List_Table { echo " $checkbox - $plugin_name - $description - - - - "; - + + $plugin_name + "; + echo $this->row_actions( $actions, true ); - echo " - "; - $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 = '' . $plugin_data['Author'] . ''; - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); - } - if ( ! empty( $plugin_data['PluginURI'] ) ) - $plugin_meta[] = '' . __( 'Visit plugin site' ) . ''; + echo " + + +
+ $description +
+
+ "; + + $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 = '' . $plugin_data['Author'] . ''; + $plugin_meta[] = sprintf( __( 'By %s' ), $author ); + } + if ( ! empty( $plugin_data['PluginURI'] ) ) + $plugin_meta[] = '' . __( 'Visit plugin site' ) . ''; + + $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 " - \n"; + echo " +
+ + +"; do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); diff --git a/wp-admin/js/common.dev.js b/wp-admin/js/common.dev.js index 4cd566f35a..ae57653f5c 100644 --- a/wp-admin/js/common.dev.js +++ b/wp-admin/js/common.dev.js @@ -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(); diff --git a/wp-admin/js/list-table.dev.js b/wp-admin/js/list-table.dev.js index f7bd06afcf..9cf9968593 100644 --- a/wp-admin/js/list-table.dev.js +++ b/wp-admin/js/list-table.dev.js @@ -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();