Customize: Clean up media control CSS.

Removes unnecessary wrapper elements and refactors class names to eliminate duplication of rule selectors.

Props celloexpressions.
Fixes #30618.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-05-12 20:23:54 +00:00
parent 97fc82a879
commit b036bf1012
8 changed files with 115 additions and 302 deletions

View File

@ -524,7 +524,7 @@ p.customize-section-description {
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
font-weight: 600; font-weight: 600;
margin-bottom: 5px; margin-bottom: 4px;
} }
.customize-control-description { .customize-control-description {
@ -720,12 +720,10 @@ p.customize-section-description {
/* Media controls */ /* Media controls */
.customize-control-media .current, .customize-control .attachment-media-view .actions {
.customize-control-upload .current, margin-top: 8px;
.customize-control-image .current, }
.customize-control-background .current,
.customize-control-cropped_image .current,
.customize-control-site_icon .current,
.customize-control-header .current { .customize-control-header .current {
margin-bottom: 8px; margin-bottom: 8px;
} }
@ -749,24 +747,9 @@ p.customize-section-description {
display: block; display: block;
} }
.customize-control-media .remove-button, .customize-control .attachment-media-view .remove-button,
.customize-control-media .default-button, .customize-control .attachment-media-view .default-button,
.customize-control-media .upload-button, .customize-control .attachment-media-view .upload-button,
.customize-control-upload .remove-button,
.customize-control-upload .default-button,
.customize-control-upload .upload-button,
.customize-control-image .remove-button,
.customize-control-image .default-button,
.customize-control-image .upload-button,
.customize-control-background .remove-button,
.customize-control-background .default-button,
.customize-control-background .upload-button,
.customize-control-cropped_image .remove-button,
.customize-control-cropped_image .default-button,
.customize-control-cropped_image .upload-button,
.customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button,
.customize-control-site_icon .upload-button,
.customize-control-header button.new, .customize-control-header button.new,
.customize-control-header button.remove { .customize-control-header button.remove {
white-space: normal; white-space: normal;
@ -774,35 +757,12 @@ p.customize-section-description {
height: auto; height: auto;
} }
.customize-control-media .current .container, .customize-control .attachment-media-view .thumbnail,
.customize-control-upload .current .container,
.customize-control-image .current .container,
.customize-control-background .current .container,
.customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container,
.customize-control-header .current .container { .customize-control-header .current .container {
overflow: hidden; overflow: hidden;
-webkit-border-radius: 2px;
border: 1px solid #eee;
-webkit-border-radius: 2px;
border-radius: 2px;
} }
.customize-control-media .current .container, .customize-control .attachment-media-view .placeholder,
.customize-control-upload .current .container,
.customize-control-background .current .container,
.customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container,
.customize-control-image .current .container {
min-height: 40px;
}
.customize-control-media .placeholder,
.customize-control-upload .placeholder,
.customize-control-image .placeholder,
.customize-control-background .placeholder,
.customize-control-cropped_image .placeholder,
.customize-control-site_icon .placeholder,
.customize-control-header .placeholder { .customize-control-header .placeholder {
width: 100%; width: 100%;
position: relative; position: relative;
@ -812,15 +772,10 @@ p.customize-section-description {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
min-height: 40px; padding: 9px 0;
line-height: 20px;
} }
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-image .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-header .inner { .customize-control-header .inner {
display: none; display: none;
position: absolute; position: absolute;
@ -831,22 +786,6 @@ p.customize-section-description {
overflow: hidden; overflow: hidden;
} }
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-image .inner {
display: block;
min-height: 40px;
}
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-image .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-header .inner, .customize-control-header .inner,
.customize-control-header .inner .dashicons { .customize-control-header .inner .dashicons {
line-height: 20px; line-height: 20px;
@ -956,40 +895,19 @@ p.customize-section-description {
margin-bottom: 0; margin-bottom: 0;
} }
.customize-control-media img, .customize-control .attachment-media-view .thumbnail-image img,
.customize-control-upload img,
.customize-control-image img,
.customize-control-background img,
.customize-control-cropped_image img,
.customize-control-header img { .customize-control-header img {
width: 100%; width: 100%;
-webkit-border-radius: 2px;
border-radius: 2px;
} }
.customize-control-media .remove-button, .customize-control .attachment-media-view .remove-button,
.customize-control-media .default-button, .customize-control .attachment-media-view .default-button,
.customize-control-upload .remove-button,
.customize-control-upload .default-button,
.customize-control-image .remove-button,
.customize-control-image .default-button,
.customize-control-background .remove-button,
.customize-control-background .default-button,
.customize-control-cropped_image .remove-button,
.customize-control-cropped_image .default-button,
.customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button,
.customize-control-header .remove { .customize-control-header .remove {
float: right; float: right;
margin-left: 3px; margin-left: 3px;
} }
.customize-control-media .upload-button, .customize-control .attachment-media-view .upload-button,
.customize-control-upload .upload-button,
.customize-control-image .upload-button,
.customize-control-background .upload-button,
.customize-control-cropped_image .upload-button,
.customize-control-site_icon .upload-button,
.customize-control-header .new { .customize-control-header .new {
float: left; float: left;
} }

File diff suppressed because one or more lines are too long

View File

@ -524,7 +524,7 @@ p.customize-section-description {
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
font-weight: 600; font-weight: 600;
margin-bottom: 5px; margin-bottom: 4px;
} }
.customize-control-description { .customize-control-description {
@ -720,12 +720,10 @@ p.customize-section-description {
/* Media controls */ /* Media controls */
.customize-control-media .current, .customize-control .attachment-media-view .actions {
.customize-control-upload .current, margin-top: 8px;
.customize-control-image .current, }
.customize-control-background .current,
.customize-control-cropped_image .current,
.customize-control-site_icon .current,
.customize-control-header .current { .customize-control-header .current {
margin-bottom: 8px; margin-bottom: 8px;
} }
@ -749,24 +747,9 @@ p.customize-section-description {
display: block; display: block;
} }
.customize-control-media .remove-button, .customize-control .attachment-media-view .remove-button,
.customize-control-media .default-button, .customize-control .attachment-media-view .default-button,
.customize-control-media .upload-button, .customize-control .attachment-media-view .upload-button,
.customize-control-upload .remove-button,
.customize-control-upload .default-button,
.customize-control-upload .upload-button,
.customize-control-image .remove-button,
.customize-control-image .default-button,
.customize-control-image .upload-button,
.customize-control-background .remove-button,
.customize-control-background .default-button,
.customize-control-background .upload-button,
.customize-control-cropped_image .remove-button,
.customize-control-cropped_image .default-button,
.customize-control-cropped_image .upload-button,
.customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button,
.customize-control-site_icon .upload-button,
.customize-control-header button.new, .customize-control-header button.new,
.customize-control-header button.remove { .customize-control-header button.remove {
white-space: normal; white-space: normal;
@ -774,35 +757,12 @@ p.customize-section-description {
height: auto; height: auto;
} }
.customize-control-media .current .container, .customize-control .attachment-media-view .thumbnail,
.customize-control-upload .current .container,
.customize-control-image .current .container,
.customize-control-background .current .container,
.customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container,
.customize-control-header .current .container { .customize-control-header .current .container {
overflow: hidden; overflow: hidden;
-webkit-border-radius: 2px;
border: 1px solid #eee;
-webkit-border-radius: 2px;
border-radius: 2px;
} }
.customize-control-media .current .container, .customize-control .attachment-media-view .placeholder,
.customize-control-upload .current .container,
.customize-control-background .current .container,
.customize-control-cropped_image .current .container,
.customize-control-site_icon .current .container,
.customize-control-image .current .container {
min-height: 40px;
}
.customize-control-media .placeholder,
.customize-control-upload .placeholder,
.customize-control-image .placeholder,
.customize-control-background .placeholder,
.customize-control-cropped_image .placeholder,
.customize-control-site_icon .placeholder,
.customize-control-header .placeholder { .customize-control-header .placeholder {
width: 100%; width: 100%;
position: relative; position: relative;
@ -812,15 +772,10 @@ p.customize-section-description {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
min-height: 40px; padding: 9px 0;
line-height: 20px;
} }
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-image .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-header .inner { .customize-control-header .inner {
display: none; display: none;
position: absolute; position: absolute;
@ -831,22 +786,6 @@ p.customize-section-description {
overflow: hidden; overflow: hidden;
} }
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-image .inner {
display: block;
min-height: 40px;
}
.customize-control-media .inner,
.customize-control-upload .inner,
.customize-control-image .inner,
.customize-control-background .inner,
.customize-control-cropped_image .inner,
.customize-control-site_icon .inner,
.customize-control-header .inner, .customize-control-header .inner,
.customize-control-header .inner .dashicons { .customize-control-header .inner .dashicons {
line-height: 20px; line-height: 20px;
@ -956,40 +895,19 @@ p.customize-section-description {
margin-bottom: 0; margin-bottom: 0;
} }
.customize-control-media img, .customize-control .attachment-media-view .thumbnail-image img,
.customize-control-upload img,
.customize-control-image img,
.customize-control-background img,
.customize-control-cropped_image img,
.customize-control-header img { .customize-control-header img {
width: 100%; width: 100%;
-webkit-border-radius: 2px;
border-radius: 2px;
} }
.customize-control-media .remove-button, .customize-control .attachment-media-view .remove-button,
.customize-control-media .default-button, .customize-control .attachment-media-view .default-button,
.customize-control-upload .remove-button,
.customize-control-upload .default-button,
.customize-control-image .remove-button,
.customize-control-image .default-button,
.customize-control-background .remove-button,
.customize-control-background .default-button,
.customize-control-cropped_image .remove-button,
.customize-control-cropped_image .default-button,
.customize-control-site_icon .remove-button,
.customize-control-site_icon .default-button,
.customize-control-header .remove { .customize-control-header .remove {
float: left; float: left;
margin-right: 3px; margin-right: 3px;
} }
.customize-control-media .upload-button, .customize-control .attachment-media-view .upload-button,
.customize-control-upload .upload-button,
.customize-control-image .upload-button,
.customize-control-background .upload-button,
.customize-control-cropped_image .upload-button,
.customize-control-site_icon .upload-button,
.customize-control-header .new { .customize-control-header .new {
float: right; float: right;
} }

File diff suppressed because one or more lines are too long

View File

@ -121,15 +121,12 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
<# if (data.random) { #> <# if (data.random) { #>
<div class="placeholder"> <div class="placeholder">
<div class="inner"> <span class="dashicons dashicons-randomize dice"></span>
<span><span class="dashicons dashicons-randomize dice"></span> <# if ( data.type === 'uploaded' ) { #>
<# if ( data.type === 'uploaded' ) { #> <?php _e( 'Randomizing uploaded headers' ); ?>
<?php _e( 'Randomizing uploaded headers' ); ?> <# } else if ( data.type === 'default' ) { #>
<# } else if ( data.type === 'default' ) { #> <?php _e( 'Randomizing suggested headers' ); ?>
<?php _e( 'Randomizing suggested headers' ); ?> <# } #>
<# } #>
</span>
</div>
</div> </div>
<# } else { #> <# } else { #>
@ -140,11 +137,7 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
<# } else { #> <# } else { #>
<div class="placeholder"> <div class="placeholder">
<div class="inner"> <?php _e( 'No image set' ); ?>
<span>
<?php _e( 'No image set' ); ?>
</span>
</div>
</div> </div>
<# } #> <# } #>

View File

@ -154,72 +154,62 @@ class WP_Customize_Media_Control extends WP_Customize_Control {
</label> </label>
<# if ( data.attachment && data.attachment.id ) { #> <# if ( data.attachment && data.attachment.id ) { #>
<div class="current"> <div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}">
<div class="container"> <div class="thumbnail thumbnail-{{ data.attachment.type }}">
<div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}"> <# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium ) { #>
<div class="thumbnail thumbnail-{{ data.attachment.type }}"> <img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" alt="" />
<# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium ) { #> <# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.full ) { #>
<img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" alt="" /> <img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" alt="" />
<# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.full ) { #> <# } else if ( 'audio' === data.attachment.type ) { #>
<img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" alt="" /> <# if ( data.attachment.image && data.attachment.image.src && data.attachment.image.src !== data.attachment.icon ) { #>
<# } else if ( 'audio' === data.attachment.type ) { #> <img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" alt="" />
<# if ( data.attachment.image && data.attachment.image.src && data.attachment.image.src !== data.attachment.icon ) { #> <# } else { #>
<img src="{{ data.attachment.image.src }}" class="thumbnail" draggable="false" alt="" /> <img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" alt="" />
<# } else { #> <# } #>
<img src="{{ data.attachment.icon }}" class="attachment-thumb type-icon" draggable="false" alt="" /> <p class="attachment-meta attachment-meta-title">&#8220;{{ data.attachment.title }}&#8221;</p>
<# } #> <# if ( data.attachment.album || data.attachment.meta.album ) { #>
<p class="attachment-meta attachment-meta-title">&#8220;{{ data.attachment.title }}&#8221;</p> <p class="attachment-meta"><em>{{ data.attachment.album || data.attachment.meta.album }}</em></p>
<# if ( data.attachment.album || data.attachment.meta.album ) { #> <# } #>
<p class="attachment-meta"><em>{{ data.attachment.album || data.attachment.meta.album }}</em></p> <# if ( data.attachment.artist || data.attachment.meta.artist ) { #>
<# } #> <p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p>
<# if ( data.attachment.artist || data.attachment.meta.artist ) { #> <# } #>
<p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p> <audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
<# } #> <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none"> </audio>
<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/> <# } else if ( 'video' === data.attachment.type ) { #>
</audio> <div class="wp-media-wrapper wp-video">
<# } else if ( 'video' === data.attachment.type ) { #> <video controls="controls" class="wp-video-shortcode" preload="metadata"
<div class="wp-media-wrapper wp-video"> <# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>>
<video controls="controls" class="wp-video-shortcode" preload="metadata" <source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
<# if ( data.attachment.image && data.attachment.image.src !== data.attachment.icon ) { #>poster="{{ data.attachment.image.src }}"<# } #>> </video>
<source type="{{ data.attachment.mime }}" src="{{ data.attachment.url }}"/>
</video>
</div>
<# } else { #>
<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" alt="" />
<p class="attachment-title">{{ data.attachment.title }}</p>
<# } #>
</div> </div>
</div> <# } else { #>
<img class="attachment-thumb type-icon icon" src="{{ data.attachment.icon }}" draggable="false" alt="" />
<p class="attachment-title">{{ data.attachment.title }}</p>
<# } #>
</div>
<div class="actions">
<# if ( data.canUpload ) { #>
<button type="button" class="button remove-button">{{ data.button_labels.remove }}</button>
<button type="button" class="button upload-button control-focus" id="{{ data.settings['default'] }}-button">{{ data.button_labels.change }}</button>
<div style="clear:both"></div>
<# } #>
</div> </div>
</div>
<div class="actions">
<# if ( data.canUpload ) { #>
<button type="button" class="button remove-button">{{ data.button_labels.remove }}</button>
<button type="button" class="button upload-button control-focus" id="{{ data.settings['default'] }}-button">{{ data.button_labels.change }}</button>
<div style="clear:both"></div>
<# } #>
</div> </div>
<# } else { #> <# } else { #>
<div class="current"> <div class="attachment-media-view">
<div class="container"> <div class="placeholder">
<div class="placeholder"> {{ data.button_labels.placeholder }}
<div class="inner"> </div>
<span> <div class="actions">
{{ data.button_labels.placeholder }} <# if ( data.defaultAttachment ) { #>
</span> <button type="button" class="button default-button">{{ data.button_labels['default'] }}</button>
</div> <# } #>
</div> <# if ( data.canUpload ) { #>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.select }}</button>
<# } #>
<div style="clear:both"></div>
</div> </div>
</div>
<div class="actions">
<# if ( data.defaultAttachment ) { #>
<button type="button" class="button default-button">{{ data.button_labels['default'] }}</button>
<# } #>
<# if ( data.canUpload ) { #>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button">{{ data.button_labels.select }}</button>
<# } #>
<div style="clear:both"></div>
</div> </div>
<# } #> <# } #>
<?php <?php

View File

@ -60,8 +60,7 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
</label> </label>
<# if ( data.attachment && data.attachment.id ) { #> <# if ( data.attachment && data.attachment.id ) { #>
<div class="current"> <div class="attachment-media-view">
<div class="container">
<div class="site-icon-preview"> <div class="site-icon-preview">
<div class="favicon-preview"> <div class="favicon-preview">
<img src="<?php echo esc_url( admin_url( 'images/browser.png' ) ); ?>" class="browser-preview" width="182" alt="" /> <img src="<?php echo esc_url( admin_url( 'images/browser.png' ) ); ?>" class="browser-preview" width="182" alt="" />
@ -73,34 +72,29 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
</div> </div>
<img class="app-icon-preview" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/> <img class="app-icon-preview" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
</div> </div>
</div> <div class="actions">
</div> <# if ( data.canUpload ) { #>
<div class="actions"> <button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
<# if ( data.canUpload ) { #> <button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button> <div style="clear:both"></div>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button> <# } #>
<div style="clear:both"></div> </div>
<# } #> </div>
</div> <# } else { #>
<# } else { #> <div class="attachment-media-view">
<div class="current"> <div class="placeholder">
<div class="container"> <?php echo $this->button_labels['placeholder']; ?>
<div class="placeholder"> </div>
<div class="inner"> <div class="actions">
<span><?php echo $this->button_labels['placeholder']; ?></span> <# if ( data.defaultAttachment ) { #>
</div> <button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
<# } #>
<# if ( data.canUpload ) { #>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
<# } #>
<div style="clear:both"></div>
</div> </div>
</div> </div>
</div>
<div class="actions">
<# if ( data.defaultAttachment ) { #>
<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
<# } #>
<# if ( data.canUpload ) { #>
<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
<# } #>
<div style="clear:both"></div>
</div>
<# } #> <# } #>
<?php <?php
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-alpha-37425'; $wp_version = '4.6-alpha-37426';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.