Add 'Install now', 'Preview', and 'Details' links to theme install list items. fixes #20403.
git-svn-id: http://core.svn.wordpress.org/trunk@20730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3c9a06672e
commit
8d3c911831
|
@ -5373,28 +5373,27 @@ body.full-overlay-active {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-theme-info .theme-version {
|
.theme-details .theme-version {
|
||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
float: right;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-theme-info .theme-rating {
|
.theme-details .theme-rating {
|
||||||
margin: 14px 0;
|
margin: 14px 0;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 17px;
|
height: 17px;
|
||||||
float: left;
|
float: right;
|
||||||
background: url('../images/stars.png?ver=20120307') repeat-x bottom left;
|
background: url('../images/stars.png?ver=20120307') repeat-x bottom left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-theme-info .theme-rating div {
|
.theme-details .theme-rating div {
|
||||||
background: url('../images/stars.png?ver=20120307') repeat-x top left;
|
background: url('../images/stars.png?ver=20120307') repeat-x top left;
|
||||||
height: 17px;
|
height: 17px;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-theme-info .theme-description {
|
.theme-details .theme-description {
|
||||||
margin-top: 34px;
|
float: left;
|
||||||
padding-top: 1em;
|
|
||||||
color: #777;
|
color: #777;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,14 +192,35 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
'theme' => $theme->slug,
|
'theme' => $theme->slug,
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
$actions = array();
|
||||||
|
|
||||||
|
$install_url = add_query_arg( array(
|
||||||
|
'action' => 'install-theme',
|
||||||
|
'theme' => $theme->slug,
|
||||||
|
), self_admin_url( 'update.php' ) );
|
||||||
|
$actions[] = '<a class="install-now" href="' . wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
|
||||||
|
|
||||||
|
$actions[] = '<a class="install-theme-preview" href="#" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>';
|
||||||
|
|
||||||
|
$actions = apply_filters( 'theme_install_actions', $actions, $theme );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<a class="screenshot" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
|
<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
|
||||||
<img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
|
<img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<h3><?php echo $name; ?></h3>
|
<h3><?php echo $name; ?></h3>
|
||||||
<div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
|
<div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
|
||||||
|
|
||||||
|
<div class="action-links">
|
||||||
|
<ul>
|
||||||
|
<?php foreach ( $actions as $action ): ?>
|
||||||
|
<li><?php echo $action; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<li class="hide-if-no-js"><a href="#" class="theme-detail" tabindex='4'><?php _e('Details') ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$this->install_theme_info( $theme );
|
$this->install_theme_info( $theme );
|
||||||
}
|
}
|
||||||
|
@ -277,15 +298,17 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
|
||||||
<?php if ( isset( $theme->screenshot_url ) ): ?>
|
<?php if ( isset( $theme->screenshot_url ) ): ?>
|
||||||
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
|
<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
|
<div class="theme-details">
|
||||||
<div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
|
<div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
|
||||||
</div>
|
<div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
|
||||||
<div class="theme-version">
|
</div>
|
||||||
<strong><?php _e('Version:') ?> </strong>
|
<div class="theme-version">
|
||||||
<?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
|
<strong><?php _e('Version:') ?> </strong>
|
||||||
</div>
|
<?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
|
||||||
<div class="theme-description">
|
</div>
|
||||||
<?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
|
<div class="theme-description">
|
||||||
|
<?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
|
<input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,15 @@
|
||||||
*/
|
*/
|
||||||
jQuery( function($) {
|
jQuery( function($) {
|
||||||
$('#availablethemes').on( 'click', '.theme-detail', function (event) {
|
$('#availablethemes').on( 'click', '.theme-detail', function (event) {
|
||||||
$(this).parents('.action-links').siblings('.themedetaildiv').toggle();
|
var theme = $(this).closest('.available-theme'),
|
||||||
|
details = theme.find('.themedetaildiv');
|
||||||
|
|
||||||
|
if ( ! details.length ) {
|
||||||
|
details = theme.find('.install-theme-info .theme-details');
|
||||||
|
details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
details.toggle();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -34,10 +42,10 @@ jQuery( function($) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#availablethemes').on( 'click', '.installable-theme', function( event ) {
|
$('#availablethemes').on( 'click', '.install-theme-preview', function( event ) {
|
||||||
var src;
|
var src;
|
||||||
|
|
||||||
info.html( $(this).find('.install-theme-info').html() );
|
info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() );
|
||||||
src = info.find( '.theme-preview-url' ).val();
|
src = info.find( '.theme-preview-url' ).val();
|
||||||
panel.html( '<iframe src="' + src + '" />');
|
panel.html( '<iframe src="' + src + '" />');
|
||||||
preview.fadeIn( 200, function() {
|
preview.fadeIn( 200, function() {
|
||||||
|
|
Loading…
Reference in New Issue