Make WordPress Core


Ignore:
Timestamp:
12/06/2012 05:52:19 AM (12 years ago)
Author:
markjaquith
Message:

Add the ability to click "Edit" and kick out to the advanced image editor from within the Media modal. New window, with "Refresh" offered on your return. fixes #22743. props koopersmith, nacin, helenyhou.

File:
1 edited

Legend:

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

    r23087 r23095  
    13381338            'delete' => false,
    13391339        ),
     1340        'editLink'   => false,
    13401341    );
    13411342
    1342     if ( current_user_can( 'edit_post', $attachment->ID ) )
     1343    if ( current_user_can( 'edit_post', $attachment->ID ) ) {
    13431344        $response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
     1345        $response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
     1346    }
    13441347
    13451348    if ( current_user_can( 'delete_post', $attachment->ID ) )
     
    17041707                <div class="filename">{{ data.filename }}</div>
    17051708                <div class="uploaded">{{ data.dateFormatted }}</div>
    1706                 <# if ( 'image' === data.type && ! data.uploading && data.width && data.height ) { #>
    1707                     <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
     1709
     1710                <# if ( 'image' === data.type && ! data.uploading ) { #>
     1711                    <# if ( data.width && data.height ) { #>
     1712                        <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
     1713                    <# } #>
     1714
     1715                    <# if ( data.can.save ) { #>
     1716                        <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
     1717                        <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
     1718                    <# } #>
    17081719                <# } #>
     1720
    17091721                <# if ( ! data.uploading && data.can.remove ) { #>
    1710                     <div class="delete-attachment">
    1711                         <a href="#"><?php _e( 'Delete Permanently' ); ?></a>
    1712                     </div>
     1722                    <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
    17131723                <# } #>
     1724
    17141725                <div class="compat-meta">
    17151726                    <# if ( data.compat && data.compat.meta ) { #>
Note: See TracChangeset for help on using the changeset viewer.