Themes: Do not show an update button if there's no update package.

This updates the list view to match the existing behaviour in the single theme modal.

Props tristangemus for initial patch.
Fixes #37774.

git-svn-id: https://develop.svn.wordpress.org/trunk@38788 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2016-10-14 13:32:29 +00:00
parent 3083effa52
commit ddeae5feee
2 changed files with 6 additions and 1 deletions

View File

@ -572,6 +572,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
'parent' => $parent,
'active' => $slug === $current_theme,
'hasUpdate' => isset( $updates[ $slug ] ),
'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ][ 'package' ] ),
'update' => get_theme_update_available( $theme ),
'actions' => array(
'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,

View File

@ -378,7 +378,11 @@ $can_install = current_user_can( 'install_themes' );
<# } #>
<# if ( data.hasUpdate ) { #>
<div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div>
<# if ( data.hasPackage ) { #>
<div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?></p></div>
<# } else { #>
<div class="update-message notice inline notice-warning notice-alt"><p><?php _e( 'New version available.' ); ?></p></div>
<# } #>
<# } #>
<span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>