diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index 4dd8b17605..a333c9b6cc 100644
--- a/wp-admin/includes/ajax-actions.php
+++ b/wp-admin/includes/ajax-actions.php
@@ -1858,8 +1858,11 @@ function wp_ajax_save_attachment() {
if ( ! empty( $changes['caption'] ) )
$args['post_excerpt'] = $changes['caption'];
+ if ( ! empty( $changes['alt'] ) )
+ $args['_wp_attachment_image_alt'] = $changes['alt'];
+
if ( $args )
- wp_update_post( array_merge( $args, array( 'ID' => $id ) ) );
+ edit_post( array_merge( $args, array( 'post_ID' => $id ) ) );
wp_send_json_success();
}
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index f4e656363a..410deca9ff 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -165,8 +165,9 @@ function edit_post( $post_data = null ) {
$post_data = _wp_translate_postdata( true, $post_data );
if ( is_wp_error($post_data) )
wp_die( $post_data->get_error_message() );
- if ( 'autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status'] )
+ if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) {
$post_data['post_status'] = 'draft';
+ }
if ( isset($post_data['visibility']) ) {
switch ( $post_data['visibility'] ) {
diff --git a/wp-includes/css/media-views.css b/wp-includes/css/media-views.css
index 8afd5c1ab6..bf935abd9f 100644
--- a/wp-includes/css/media-views.css
+++ b/wp-includes/css/media-views.css
@@ -171,6 +171,70 @@
padding-top: 5px;
}
+.media-sidebar h3 {
+ position: relative;
+ font-weight: bold;
+ text-transform: uppercase;
+ font-size: 12px;
+ color: #777;
+ text-shadow: 0 1px 0 #fff;
+ margin: 24px 0 8px;
+}
+
+/*.media-sidebar h3:before {
+ content: '\25B8';
+ display: block;
+ position: absolute;
+ top: -1px;
+ left: -12px;
+ font-size: 14px;
+ color: #ccc;
+}
+*/
+.media-sidebar .setting {
+ display: block;
+ float: left;
+ width: 100%;
+ margin: 1px 0;
+}
+
+.media-sidebar .setting span {
+ float: left;
+ min-width: 78px;
+ min-height: 24px;
+ margin-right: 7px;
+ padding-top: 8px;
+ line-height: 16px;
+ text-align: right;
+ color: #999;
+ text-shadow: 0 1px 0 #fff;
+}
+
+.media-sidebar .setting input,
+.media-sidebar .setting textarea,
+.media-sidebar .setting > .button-group {
+ min-width: 180px;
+ float: right;
+}
+
+.media-sidebar .setting input,
+.media-sidebar .setting textarea {
+ padding: 6px 8px;
+ line-height: 16px;
+ resize: none;
+}
+
+.media-sidebar .setting textarea {
+ height: 62px;
+}
+
+.media-sidebar .setting select {
+ height: 28px;
+ line-height: 28px;
+ margin-top: 3px;
+}
+
+
/**
* Menu
*/
@@ -787,22 +851,31 @@
overflow: auto;
}
-.attachment-details-preview {
- cursor: default;
+.attachment-info {
+ overflow: hidden;
+ min-height: 60px;
+ margin-bottom: 16px;
+ line-height: 18px;
+ color: #999;
+ border-bottom: 1px solid #e5e5e5;
+ box-shadow: 0 1px 0 #fff;
+ padding-bottom: 16px;
}
-.attachment-details-preview {
- width: auto;
- height: auto;
+.attachment-info .filename {
+ font-weight: bold;
+ color: #464646;
+}
+
+.attachment-info .thumbnail {
position: relative;
+ float: left;
+ max-width: 120px;
+ max-height: 120px;
+ margin-right: 10px;
}
-.attachment-details-preview .thumbnail {
- width: 100%;
- height: auto;
-}
-
-.attachment-details-preview .thumbnail:after {
+.attachment-info .thumbnail:after {
content: '';
display: block;
position: absolute;
@@ -810,21 +883,19 @@
left: 0;
right: 0;
bottom: 0;
- box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );
+ box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.15 );
overflow: hidden;
}
-.attachment-details-preview .thumbnail img {
+.attachment-info .thumbnail img {
display: block;
- max-width: 100%;
- max-height: 132px;
+ max-width: 120px;
+ max-height: 120px;
margin: 0 auto;
}
-.attachment-details .describe {
+.attachment-info .details {
float: left;
- margin: 10px 0 0;
- border-radius: 3px;
}
/**
@@ -833,4 +904,8 @@
.attachment-display-settings h4 {
margin: 1.4em 0 0.4em;
+}
+
+.gallery-settings {
+ overflow: hidden;
}
\ No newline at end of file
diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index f387903ad7..4dab3d0ad3 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -1906,8 +1906,11 @@
template: media.template('attachment'),
events: {
- 'mousedown .attachment-preview': 'toggleSelection',
- 'change .describe': 'describe'
+ 'mousedown .attachment-preview': 'toggleSelection',
+ 'change [data-setting]': 'updateSetting',
+ 'change [data-setting] input': 'updateSetting',
+ 'change [data-setting] select': 'updateSetting',
+ 'change [data-setting] textarea': 'updateSetting'
},
buttons: {},
@@ -2039,11 +2042,13 @@
}
},
- describe: function( event ) {
- if ( 'image' === this.model.get('type') )
- this.model.save( 'caption', event.target.value );
- else
- this.model.save( 'title', event.target.value );
+ updateSetting: function( event ) {
+ var $setting = $( event.target ).closest('[data-setting]');
+
+ if ( ! $setting.length )
+ return;
+
+ this.model.save( $setting.data('setting'), event.target.value );
}
});
@@ -2592,7 +2597,10 @@
template: media.template('attachment-details'),
events: {
- 'change .describe': 'describe'
+ 'change [data-setting]': 'updateSetting',
+ 'change [data-setting] input': 'updateSetting',
+ 'change [data-setting] select': 'updateSetting',
+ 'change [data-setting] textarea': 'updateSetting'
}
});
diff --git a/wp-includes/media.php b/wp-includes/media.php
index a65c636e66..956e2b1307 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -1262,6 +1262,7 @@ function wp_prepare_attachment_for_js( $attachment ) {
'type' => $type,
'subtype' => $subtype,
'icon' => wp_mime_type_icon( $attachment->ID ),
+ 'dateFormatted' => mysql2date( get_option('date_format'), $attachment->post_date ),
);
if ( $meta && 'image' === $type ) {
@@ -1436,36 +1437,53 @@ function wp_print_media_templates( $attachment ) {
@@ -1495,100 +1513,112 @@ function wp_print_media_templates( $attachment ) {