Install Plugins screen:

* Utilize the (currently-named) filter bar from the Add Themes screen.
* Move the upload link to the h2, also like the Add Themes screen.

see #28673.

Built from https://develop.svn.wordpress.org/trunk@29218


git-svn-id: http://core.svn.wordpress.org/trunk@29002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2014-07-18 04:50:15 +00:00
parent c4b561bb6c
commit 02e3a7cbe3
9 changed files with 58 additions and 16 deletions

View File

@ -465,7 +465,7 @@ p.search-box {
}
.search-box input[name="s"],
#search-plugins input[name="s"],
.tablenav .search-plugins input[name="s"],
.tagsdiv .newtag {
float: right;
height: 28px;

View File

@ -465,7 +465,7 @@ p.search-box {
}
.search-box input[name="s"],
#search-plugins input[name="s"],
.tablenav .search-plugins input[name="s"],
.tagsdiv .newtag {
float: left;
height: 28px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,10 +26,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
// These are the tabs which are shown on the page
$tabs = array();
$tabs['dashboard'] = __( 'Search' );
if ( 'search' == $tab )
$tabs['search'] = __( 'Search Results' );
$tabs['upload'] = __( 'Upload' );
$tabs['featured'] = _x( 'Featured', 'Plugin Installer' );
$tabs['popular'] = _x( 'Popular', 'Plugin Installer' );
$tabs['new'] = _x( 'Newest', 'Plugin Installer' );
@ -38,7 +37,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' );
}
$nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
$nonmenu_tabs = array( 'upload', 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
/**
* Filter the tabs shown on the Plugin Install screen.
@ -146,14 +145,42 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$display_tabs = array();
foreach ( (array) $tabs as $action => $text ) {
$class = ( $action == $tab ) ? ' class="current"' : '';
$class = 'wp-filter-link';
$class .= ( $action == $tab ) ? ' current' : '';
$href = self_admin_url('plugin-install.php?tab=' . $action);
$display_tabs['plugin-install-'.$action] = "<a href='$href'$class>$text</a>";
$display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>";
}
return $display_tabs;
}
/**
* Override parent views so we can use the filter bar display.
*/
public function views() {
$views = $this->get_views();
/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
$views = apply_filters( "views_{$this->screen->id}", $views );
?>
<div class="wp-filter">
<ul class="wp-filter-links">
<?php
if ( ! empty( $views ) ) {
foreach ( $views as $class => $view ) {
$views[ $class ] = "\t<li class='$class'>$view";
}
echo implode( " </li>\n", $views ) . "</li>\n";
}
?>
</ul>
<?php install_search_form( false ); ?>
</div>
<?php
}
/**
* Override the parent display() so we can provide a different container.
*/

View File

@ -163,8 +163,16 @@ add_action('install_plugins_dashboard', 'install_dashboard');
function install_search_form( $type_selector = true ) {
$type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
$term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
$input_attrs = '';
$button_type = 'button';
?><form id="search-plugins" method="get" action="">
// assume no $type_selector means it's a simplified search form
if ( ! $type_selector ) {
$input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__( 'Search Plugins' ) . '" ';
$button_type .= ' screen-reader-text';
}
?><form class="search-plugins" method="get" action="">
<input type="hidden" name="tab" value="search" />
<?php if ( $type_selector ) : ?>
<select name="type" id="typeselector">
@ -173,9 +181,10 @@ function install_search_form( $type_selector = true ) {
<option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>
</select>
<?php endif; ?>
<input type="search" name="s" id="plugin-search-input" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" />
<label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label>
<?php submit_button( __( 'Search Plugins' ), 'button', false, false, array( 'id' => 'search-submit' ) ); ?>
<label><span class="screen-reader-text"><?php _e('Search Plugins'); ?></span>
<input type="search" name="s" value="<?php echo esc_attr($term) ?>" <?php echo $input_attrs; ?>/>
</label>
<?php submit_button( __( 'Search Plugins' ), $button_type, false, false, array( 'id' => 'search-submit' ) ); ?>
</form><?php
}

View File

@ -73,7 +73,13 @@ get_current_screen()->set_help_sidebar(
include(ABSPATH . 'wp-admin/admin-header.php');
?>
<div class="wrap">
<h2><?php echo esc_html( $title ); ?></h2>
<h2>
<?php
echo esc_html( $title );
$href = self_admin_url( 'plugin-install.php?tab=upload' );
?>
<a href="<?php echo $href; ?>" class="upload add-new-h2"><?php _e( 'Upload Plugin' ); ?></a>
</h2>
<?php $wp_list_table->views(); ?>