Make WordPress Core


Ignore:
Timestamp:
08/05/2014 05:19:09 AM (11 years ago)
Author:
azaozz
Message:

Media modal/grid: remove thumbnail resizing from JS, only keep setting number of columns. Props avryl, see #27423.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media-template.php

    r29373 r29376  
    415415    <script type="text/html" id="tmpl-attachment">
    416416        <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
    417             <# if ( data.uploading ) { #>
    418                 <div class="media-progress-bar"><div></div></div>
    419             <# } else if ( 'image' === data.type ) { #>
    420                 <div class="thumbnail">
     417            <div class="thumbnail">
     418                <# if ( data.uploading ) { #>
     419                    <div class="media-progress-bar"><div>
     420                <# } else if ( 'image' === data.type ) { #>
    421421                    <div class="centered">
    422422                        <img src="{{ data.size.url }}" draggable="false" alt="" />
    423423                    </div>
    424                 </div>
    425             <# } else {
    426                 if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) {
    427                 #><img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" /><#
    428                 } else {
    429                 #><img src="{{ data.icon }}" class="icon" draggable="false" /><#
    430                 } #>
    431                 <div class="filename">
    432                     <div>{{ data.filename }}</div>
    433                 </div>
    434             <# } #>
     424                <# } else { #>
     425                    <div class="centered">
     426                        <# if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) { #>
     427                            <img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" />
     428                        <# } else { #>
     429                            <img src="{{ data.icon }}" class="icon" draggable="false" />
     430                        <# } #>
     431                    </div>
     432                    <div class="filename">
     433                        <div>{{ data.filename }}</div>
     434                    </div>
     435                <# } #>
     436            </div>
    435437            <# if ( data.buttons.close ) { #>
    436438                <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
     
    821823            <input type="text" class="link-to-custom" data-setting="linkUrl" />
    822824        </div>
    823     </script>
    824 
    825     <script type="text/html" id="tmpl-attachments-css">
    826         <style type="text/css" id="{{ data.id }}-css">
    827             #{{ data.id }} {
    828                 padding: 0 {{ data.gutter }}px;
    829             }
    830 
    831             #{{ data.id }} .attachment {
    832                 margin: {{ data.gutter }}px;
    833                 width: {{ data.edge }}px;
    834             }
    835 
    836             #{{ data.id }} .attachment-preview,
    837             #{{ data.id }} .attachment-preview .thumbnail {
    838                 width: {{ data.edge }}px;
    839                 height: {{ data.edge }}px;
    840             }
    841 
    842             #{{ data.id }} .portrait .thumbnail img {
    843                 max-width: {{ data.edge }}px;
    844                 height: auto;
    845             }
    846 
    847             #{{ data.id }} .landscape .thumbnail img {
    848                 width: auto;
    849                 max-height: {{ data.edge }}px;
    850             }
    851         </style>
    852825    </script>
    853826
Note: See TracChangeset for help on using the changeset viewer.