Make WordPress Core

Ticket #28977: 28977.diff

File 28977.diff, 1.5 KB (added by adamsilverstein, 11 years ago)

add a View button to the media grid detail modal

  • src/wp-includes/js/media-grid.js

     
    285285                        'click .trash-attachment':        'trashAttachment',
    286286                        'click .edit-attachment':         'editAttachment',
    287287                        'click .refresh-attachment':      'refreshAttachment',
    288                         'click .edit-image':              'handleEditImageClick'
     288                        'click .edit-image':              'handleEditImageClick',
     289                        'click .view-attachment':         'handleViewAttachmentClick'
    289290                },
    290291
    291292                initialize: function() {
     
    307308                        this.model.on( 'sync', this.afterDelete, this );
    308309                },
    309310
     311                /**
     312                 * When view is clicked, navigate to the attachment page
     313                 */
     314                handleViewAttachmentClick: function() {
     315                        window.location = this.model.get( 'link' );
     316                },
     317
    310318                preDestroy: function( event ) {
    311319                        event.preventDefault();
    312320
  • src/wp-includes/media-template.php

     
    296296                                        <# if ( 'image' === data.type && ! data.uploading ) { #>
    297297                                                <a class="button edit-image" href="#"><?php _e( 'Edit Image' ); ?></a>
    298298                                        <# } #>
     299                                                <a class="button view-attachment" href="#"><?php _e( 'View' ); ?></a>
    299300
    300301                                        <# if ( ! data.uploading && data.can.remove ) { #>
    301302                                                <?php if ( MEDIA_TRASH ): ?>