WordPress.org

Make WordPress Core

Changeset 21784


Ignore:
Timestamp:
09/07/12 21:27:07 (20 months ago)
Author:
koopersmith
Message:

Use icons for non-image attachments in the new media modal. see #21836, #21390, #21808.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r21773 r21784  
    528528            var attachment = this.model.toJSON(), 
    529529                options = { 
     530                    thumbnail:   'image' === attachment.type ? attachment.url : attachment.icon, 
     531                    uploading:   attachment.uploading, 
    530532                    orientation: attachment.orientation || 'landscape', 
    531                     thumbnail:   attachment.url || '', 
    532                     uploading:   attachment.uploading 
     533                    type:        attachment.type, 
     534                    subtype:     attachment.subtype 
    533535                }; 
    534536 
    535             // Use the medium size if possible. If the medium size 
     537            // Use the medium image size if possible. If the medium size 
    536538            // doesn't exist, then the attachment is too small. 
    537539            // In that case, use the attachment itself. 
     
    615617            first = this.collection.first(); 
    616618            sizes = first.get('sizes'); 
    617             options.thumbnail = ( sizes && sizes.thumbnail ) ? sizes.thumbnail.url : first.get('url'); 
     619 
     620            if ( 'image' === first.get('type') ) 
     621                options.thumbnail = ( sizes && sizes.thumbnail ) ? sizes.thumbnail.url : first.get('url'); 
     622            else 
     623                options.thumbnail =  first.get('icon'); 
    618624 
    619625            this.$el.html( this.template( options ) ); 
  • trunk/wp-includes/media.php

    r21778 r21784  
    15771577        'type'        => $type, 
    15781578        'subtype'     => $subtype, 
     1579        'icon'        => wp_mime_type_icon( $attachment->post_mime_type ), 
    15791580    ); 
    15801581 
     
    16471648 
    16481649    <script type="text/html" id="tmpl-attachment"> 
    1649         <div class="attachment-thumbnail <%- orientation %>"> 
     1650        <div class="attachment-thumbnail type-<%- type %> subtype-<%- subtype %> <%- orientation %>"> 
    16501651            <% if ( thumbnail ) { %> 
    16511652                <img src="<%- thumbnail %>" /> 
Note: See TracChangeset for help on using the changeset viewer.