Make WordPress Core

Changeset 29085


Ignore:
Timestamp:
07/11/2014 05:21:04 AM (10 years ago)
Author:
wonderboymusic
Message:

Media Grid:

  • The "Edit Image" link in the attachment modal details is redundant.
  • After an attachment is deleted in the modal, automatically move to the next attachment in the library. If there are no attachments left, close the modal.

See #24716.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r29081 r29085  
    304304            this.model.on( 'add', this.select, this );
    305305            this.model.on( 'remove', this.deselect, this );
     306            this.model.on( 'sync', this.afterDelete, this );
     307        },
     308
     309        deleteAttachment: function( event ) {
     310            event.preventDefault();
     311
     312            this.lastIndex = this.controller.getCurrentIndex();
     313            this.hasNext = this.controller.hasNext();
     314
     315            media.view.Attachment.Details.prototype.deleteAttachment.apply( this, arguments );
     316        },
     317
     318        afterDelete: function( model ) {
     319            if ( ! model.destroyed ) {
     320                return;
     321            }
     322
     323            var frame = this.controller, index = this.lastIndex;
     324
     325            if ( ! frame.library.length ) {
     326                media.frame.modal.close();
     327                return;
     328            }
     329
     330            if ( this.hasNext ) {
     331                index -= 1;
     332            }
     333            frame.model = frame.library.at( index );
     334            frame.nextMediaItem();
    306335        },
    307336
  • trunk/src/wp-includes/media-template.php

    r29082 r29085  
    290290                    <# if ( data.width && data.height ) { #>
    291291                        <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
    292                     <# } #>
    293 
    294                     <# if ( data.can.save ) { #>
    295                         <a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
    296                         <a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
    297292                    <# } #>
    298293                <# } #>
Note: See TracChangeset for help on using the changeset viewer.