| 1 | Index: wp-includes/js/media-views.js |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/js/media-views.js (revision 22857) |
|---|
| 4 | +++ wp-includes/js/media-views.js (working copy) |
|---|
| 5 | @@ -3403,7 +3403,17 @@ |
|---|
| 6 | 'change [data-setting]': 'updateSetting', |
|---|
| 7 | 'change [data-setting] input': 'updateSetting', |
|---|
| 8 | 'change [data-setting] select': 'updateSetting', |
|---|
| 9 | - 'change [data-setting] textarea': 'updateSetting' |
|---|
| 10 | + 'change [data-setting] textarea': 'updateSetting', |
|---|
| 11 | + 'click .delete-attachment': 'remove' |
|---|
| 12 | + }, |
|---|
| 13 | + |
|---|
| 14 | + remove: function(event) { |
|---|
| 15 | + event.preventDefault(); |
|---|
| 16 | + |
|---|
| 17 | + if ( showNotice.warn() ) { |
|---|
| 18 | + $.get(deleteLink); |
|---|
| 19 | + // And then remove the model and clear the query cache... |
|---|
| 20 | + } |
|---|
| 21 | } |
|---|
| 22 | }); |
|---|
| 23 | |
|---|
| 24 | Index: wp-includes/media.php |
|---|
| 25 | =================================================================== |
|---|
| 26 | --- wp-includes/media.php (revision 22859) |
|---|
| 27 | +++ wp-includes/media.php (working copy) |
|---|
| 28 | @@ -1327,6 +1327,8 @@ |
|---|
| 29 | 'subtype' => $subtype, |
|---|
| 30 | 'icon' => wp_mime_type_icon( $attachment->ID ), |
|---|
| 31 | 'dateFormatted' => mysql2date( get_option('date_format'), $attachment->post_date ), |
|---|
| 32 | + 'deleteLink' => str_replace( '&', '&', wp_nonce_url( "post.php?action=delete&post=$attachment->ID", 'delete-post_' . $attachment->ID ) ), |
|---|
| 33 | + 'editLink' => get_edit_post_link( $attachment->ID, 'display' ), |
|---|
| 34 | ); |
|---|
| 35 | |
|---|
| 36 | if ( $meta && 'image' === $type ) { |
|---|
| 37 | @@ -1642,6 +1644,12 @@ |
|---|
| 38 | <# if ( 'image' === data.type && ! data.uploading ) { #> |
|---|
| 39 | <div class="dimensions">{{ data.width }} × {{ data.height }}</div> |
|---|
| 40 | <# } #> |
|---|
| 41 | + <div class="edit-link"> |
|---|
| 42 | + <a class="edit-attachment" href="{{ data.editLink }}" target="_blank"><?php _x( 'Edit', 'media item' ); ?></a> |
|---|
| 43 | + </div> |
|---|
| 44 | + <div class="delete-link"> |
|---|
| 45 | + <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ) ?></a> |
|---|
| 46 | + </div> |
|---|
| 47 | </div> |
|---|
| 48 | <div class="compat-meta"> |
|---|
| 49 | <# if ( data.compat && data.compat.meta ) { #> |
|---|