Restyle the plugin install details modal to match the rest of the admin. Props avryl and paulwilde for initial mockup, see #26952

git-svn-id: https://develop.svn.wordpress.org/trunk@27559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-03-16 18:27:38 +00:00
parent 6c28dfde29
commit 6d13e3e1ff
4 changed files with 276 additions and 151 deletions

View File

@ -1788,58 +1788,116 @@ div.action-links {
margin: 6px 0 0; margin: 6px 0 0;
} }
/* Header on thickbox */ /* Plugin install thickbox */
#plugin-information-header {
margin: 0;
padding: 0 5px;
font-weight: 600;
position: relative;
border-bottom: 1px solid #dfdfdf;
height: 2.5em;
background-color: #f9f9f9;
}
#plugin-information ul#sidemenu {
font-weight: normal;
margin: 0 5px;
position: absolute;
left: 0;
bottom: -1px;
}
/* Install sidemenu */
#plugin-information { #plugin-information {
background: #fcfcfc;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: auto; height: auto;
padding: 0;
} }
#plugin-information p.action-button { #plugin-information-title {
width: 100%; padding: 0 36px 0 16px;
padding-bottom: 0; font-size: 18px;
margin-bottom: 0;
margin-top: 10px;
-webkit-border-top-left-radius: 3px;
border-top-left-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
border-bottom-left-radius: 3px;
}
#plugin-information .action-button a {
background-color: #2ea2cc;
color: #fff;
text-align: center;
font-weight: 600; font-weight: 600;
text-decoration: none; line-height: 36px;
display: block; top: 0;
line-height: 2em; right: 0;
left: 0;
height: 36px;
border-bottom: 1px solid #ddd;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
#plugin-information h2 { #plugin-information-tabs {
clear: none !important; padding: 0 16px;
margin-right: 200px; position: absolute;
top: 56px;
right: 0;
left: 0;
height: 36px;
z-index: 1;
}
#plugin-information-tabs a {
position: relative;
float: left;
padding: 8px 10px 9px;
margin: 0;
height: 18px;
line-height: 18px;
font-size: 14px;
text-decoration: none;
transition: none;
}
#plugin-information-tabs a.current {
margin: -1px -1px 0;
background: #fff;
border: 1px solid #ddd;
border-bottom: none;
color: #333;
}
#plugin-information-tabs a:active,
#plugin-information-tabs a:focus {
outline: none;
}
#plugin-information-content {
background: #fff;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
position: absolute;
top: 90px;
right: 0;
bottom: 44px;
left: 0;
overflow: auto;
}
#section-holder {
margin: 0;
padding: 10px 26px;
position: absolute;
top: 0;
right: 250px;
bottom: 0;
left: 0;
}
#section-holder .updated {
margin: 16px 0;
} }
#plugin-information .fyi { #plugin-information .fyi {
margin: 0 10px 50px; background: #f3f3f3;
width: 210px; border: 1px solid #ddd;
border-top: 0;
color: #666;
padding: 16px;
position: absolute;
top: 0;
right: 0;
width: 217px;
}
#plugin-information .fyi strong {
color: #464646;
}
#plugin-information .fyi h3 {
font-weight: bold;
text-transform: uppercase;
font-size: 12px;
color: #666;
margin: 24px 0 8px;
} }
#plugin-information .fyi h2 { #plugin-information .fyi h2 {
@ -1848,35 +1906,34 @@ div.action-links {
margin-right: 0; margin-right: 0;
} }
#plugin-information .fyi h2.mainheader {
padding: 5px;
-webkit-border-top-left-radius: 3px;
border-top-left-radius: 3px;
background-color: #cee1ef;
}
#plugin-information .fyi ul { #plugin-information .fyi ul {
padding: 10px 5px 10px 7px; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
-webkit-border-bottom-left-radius: 3px;
border-bottom-left-radius: 3px;
background-color: #eaf3fa;
} }
#plugin-information .fyi li { #plugin-information .fyi li {
margin-right: 0; margin: 0 0 10px;
} }
#plugin-information #section-holder { #plugin-information-footer {
padding: 10px; padding: 8px 16px;
position: absolute;
right: 0;
bottom: 0;
left: 0;
} }
#plugin-information .section ul, #plugin-information .section ul,
#plugin-information .section ol { #plugin-information .section ol {
margin-left: 16px; list-style-type: disc;
list-style-type: square; margin-left: 24px;
list-style-image: none; }
#plugin-information .section,
#plugin-information .section p {
font-size: 14px;
line-height: 1.7;
} }
#plugin-information #section-screenshots ol { #plugin-information #section-screenshots ol {
@ -1886,21 +1943,17 @@ div.action-links {
#plugin-information #section-screenshots li img { #plugin-information #section-screenshots li img {
vertical-align: text-top; vertical-align: text-top;
margin-top: 16px;
max-width: 100%; max-width: 100%;
width: auto; width: auto;
height: auto; height: auto;
-webkit-box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 );
box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 );
} }
#plugin-information #section-screenshots li p { #plugin-information #section-screenshots li p {
font-style: italic; font-style: italic;
padding-left: 20px; padding-left: 20px;
padding-bottom: 2em;
}
#plugin-information #section-screenshots ol,
#plugin-information .updated,
#plugin-information pre {
margin-right: 215px;
} }
#plugin-information pre { #plugin-information pre {
@ -1909,15 +1962,78 @@ div.action-links {
border: 1px solid #ccc; border: 1px solid #ccc;
} }
#plugin-information pre,
#plugin-information code {
background-color: #ededff;
}
.plugin-version-author-uri { .plugin-version-author-uri {
font-size: 13px; font-size: 13px;
} }
@media screen and ( max-width: 782px ) {
#plugin-information-content {
overflow: auto;
bottom: 62px;
}
#plugin-information .fyi {
border: 1px solid #ddd;
position: static;
width: auto;
margin: 26px 26px 16px;
}
#section-holder {
position: static;
}
#plugin-information .fyi h3,
#plugin-information .fyi small {
display: none;
}
#plugin-information-footer {
padding: 12px 16px;
height: 37px;
}
}
/* Thickbox for Plugin Install screen */
body.plugin-install-php #TB_window,
body.index-php #TB_window {
background: #fcfcfc url( ../images/spinner.gif ) no-repeat center;
}
@media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
body.plugin-install-php #TB_window,
body.index-php #TB_window {
background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center;
}
}
body.plugin-install-php #TB_title,
body.index-php #TB_title {
float: left;
height: 1px;
}
body.plugin-install-php #TB_ajaxWindowTitle,
body.index-php #TB_ajaxWindowTitle {
display: none;
}
body.plugin-install-php .tb-close-icon,
body.index-php .tb-close-icon {
line-height: 36px;
width: 36px;
height: 36px;
}
body.plugin-install-php .tb-close-icon:before,
body.index-php .tb-close-icon:before {
line-height: 36px;
}
/* @todo: move this. */ /* @todo: move this. */
img { img {
border: none; border: none;

View File

@ -334,13 +334,17 @@ function install_plugin_information() {
); );
//Sanitize HTML //Sanitize HTML
foreach ( (array)$api->sections as $section_name => $content ) foreach ( (array)$api->sections as $section_name => $content ) {
$api->sections[$section_name] = wp_kses($content, $plugins_allowedtags); $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
}
foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) { foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
if ( isset( $api->$key ) ) if ( isset( $api->$key ) )
$api->$key = wp_kses( $api->$key, $plugins_allowedtags ); $api->$key = wp_kses( $api->$key, $plugins_allowedtags );
} }
$_tab = esc_attr( $tab );
$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English. $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) { if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
$section_titles = array_keys( (array) $api->sections ); $section_titles = array_keys( (array) $api->sections );
@ -348,8 +352,10 @@ function install_plugin_information() {
} }
iframe_header( __('Plugin Install') ); iframe_header( __('Plugin Install') );
echo "<div id='$tab-header'>\n";
echo "<ul id='sidemenu'>\n"; echo "<div id='{$_tab}-title'>{$api->name}</div>";
echo "<div id='{$_tab}-tabs'>\n";
foreach ( (array)$api->sections as $section_name => $content ) { foreach ( (array)$api->sections as $section_name => $content ) {
if ( isset( $plugins_section_titles[ $section_name ] ) ) if ( isset( $plugins_section_titles[ $section_name ] ) )
@ -361,36 +367,14 @@ function install_plugin_information() {
$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) ); $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
$href = esc_url( $href ); $href = esc_url( $href );
$san_section = esc_attr( $section_name ); $san_section = esc_attr( $section_name );
echo "\t<li><a name='$san_section' href='$href' $class>$title</a></li>\n"; echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
} }
echo "</ul>\n";
echo "</div>\n"; echo "</div>\n";
?> ?>
<div class="alignright fyi"> <div id="<?php echo $_tab; ?>-content">
<?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?> <div class="fyi">
<p class="action-button">
<?php
$status = install_plugin_install_status($api);
switch ( $status['status'] ) {
case 'install':
if ( $status['url'] )
echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
break;
case 'update_available':
if ( $status['url'] )
echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
break;
case 'newer_installed':
echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
break;
case 'latest_installed':
echo '<a>' . __('Latest Version Installed') . '</a>';
break;
}
?>
</p>
<?php endif; ?>
<h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI') ?></h2>
<ul> <ul>
<?php if ( ! empty( $api->version ) ) : ?> <?php if ( ! empty( $api->version ) ) : ?>
<li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li> <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
@ -412,7 +396,7 @@ function install_plugin_information() {
<?php endif; ?> <?php endif; ?>
</ul> </ul>
<?php if ( ! empty( $api->rating ) ) : ?> <?php if ( ! empty( $api->rating ) ) : ?>
<h2><?php _e('Average Rating') ?></h2> <h3><?php _e('Average Rating') ?></h3>
<?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
<small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small> <small><?php printf( _n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings) ); ?></small>
<?php endif; ?> <?php endif; ?>
@ -440,11 +424,32 @@ function install_plugin_information() {
$display = ( $section_name == $section ) ? 'block' : 'none'; $display = ( $section_name == $section ) ? 'block' : 'none';
echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n"; echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
echo "\t\t<h2 class='long-header'>$title</h2>";
echo $content; echo $content;
echo "\t</div>\n"; echo "\t</div>\n";
} }
echo "</div>\n"; echo "</div>\n";
echo "</div>\n";
echo "<div id='$tab-footer'>\n";
if ( ! empty( $api->download_link ) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) {
$status = install_plugin_install_status($api);
switch ( $status['status'] ) {
case 'install':
if ( $status['url'] )
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
break;
case 'update_available':
if ( $status['url'] )
echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
break;
case 'newer_installed':
echo '<a class="button button-primary right">' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
break;
case 'latest_installed':
echo '<a class="button button-primary right">' . __('Latest Version Installed') . '</a>';
break;
}
}
echo "</div>\n";
iframe_footer(); iframe_footer();
exit; exit;

View File

@ -6,33 +6,37 @@ jQuery(document).ready(function($) {
tb_position = function() { tb_position = function() {
var tbWindow = $( '#TB_window' ), var tbWindow = $( '#TB_window' ),
width = $( window ).width(), width = $( window ).width(),
H = $(window).height(), H = $( window ).height() - ( ( 850 < width ) ? 60 : 20 ),
W = ( 720 < width ) ? 720 : width, W = ( 850 < width ) ? 830 : width - 20;
adminbar_height = 0;
if ( $('#wpadminbar').length ) {
adminbar_height = parseInt( $('#wpadminbar').css('height'), 10 );
}
if ( tbWindow.size() ) { if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); tbWindow.width( W ).height( H );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); $( '#TB_iframeContent' ).width( W ).height( H );
tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'}); tbWindow.css({
if ( typeof document.body.style.maxWidth !== 'undefined' ) 'margin-left': '-' + parseInt( ( W / 2 ), 10 ) + 'px'
tbWindow.css({'top': 20 + adminbar_height + 'px', 'margin-top': '0'}); });
if ( typeof document.body.style.maxWidth !== 'undefined' ) {
tbWindow.css({
'top': ( ( 850 < width ) ? 30 : 10 ) + 'px',
'margin-top': '0'
});
}
} }
return $( 'a.thickbox' ).each( function() { return $( 'a.thickbox' ).each( function() {
var href = $( this ).attr( 'href' ); var href = $( this ).attr( 'href' );
if ( ! href ) if ( ! href ) {
return; return;
}
href = href.replace( /&width=[0-9]+/g, '' ); href = href.replace( /&width=[0-9]+/g, '' );
href = href.replace( /&height=[0-9]+/g, '' ); href = href.replace( /&height=[0-9]+/g, '' );
$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); $(this).attr( 'href', href + '&width=' + W + '&height=' + ( H ) );
}); });
}; };
$(window).resize(function(){ tb_position(); }); $( window ).resize( function() {
tb_position();
});
$('.plugins').on( 'click', 'a.thickbox', function() { $('.plugins').on( 'click', 'a.thickbox', function() {
tb_click.call(this); tb_click.call(this);
@ -43,15 +47,15 @@ jQuery(document).ready(function($) {
}); });
/* Plugin install related JS*/ /* Plugin install related JS*/
$('#plugin-information #sidemenu a').click( function() { $( '#plugin-information-tabs a' ).click( function( event ) {
var tab = $( this ).attr( 'name' ); var tab = $( this ).attr( 'name' );
event.preventDefault();
//Flip the tab //Flip the tab
$('#plugin-information-header a.current').removeClass('current'); $( '#plugin-information-tabs a.current' ).removeClass( 'current' );
$( this ).addClass( 'current' ); $( this ).addClass( 'current' );
//Flip the content. //Flip the content.
$( '#section-holder div.section' ).hide(); //Hide 'em all $( '#section-holder div.section' ).hide(); //Hide 'em all
$( '#section-' + tab ).show(); $( '#section-' + tab ).show();
return false;
}); });
$( 'a.install-now' ).click( function() { $( 'a.install-now' ).click( function() {