Provide visual feedback for "Use as thumbnail" when clicked immediately after uploading the image. fixes #11140
git-svn-id: http://svn.automattic.com/wordpress/trunk@12355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
817376b35f
commit
805bdb9365
|
@ -1245,7 +1245,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
|||
elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set
|
||||
$calling_post_id = $post->post_parent;
|
||||
if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id )
|
||||
$thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
|
||||
$thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
|
||||
|
||||
if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) )
|
||||
$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function WPSetAsThumbnail(id){
|
||||
var $link = jQuery('#media-item-' + id + ' a.wp-post-thumbnail');
|
||||
var $link = jQuery('a#wp-post-thumbnail-' + id);
|
||||
|
||||
$link.text( setPostThumbnailL10n.saving );
|
||||
jQuery.post(ajaxurl, {
|
||||
|
|
|
@ -1 +1 @@
|
|||
function WPSetAsThumbnail(id){var $link=jQuery("#media-item-"+id+" a.wp-post-thumbnail");$link.text(setPostThumbnailL10n.saving);jQuery.post(ajaxurl,{action:"set-post-thumbnail",post_id:post_id,thumbnail_id:id,cookie:encodeURIComponent(document.cookie)},function(str){var win=window.dialogArguments||opener||parent||top;$link.text(setPostThumbnailL10n.setThumbnail);if(str=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").show();$link.text(setPostThumbnailL10n.done);$link.fadeOut(2000);win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str)}})};
|
||||
function WPSetAsThumbnail(id){var $link=jQuery("a#wp-post-thumbnail-"+id);$link.text(setPostThumbnailL10n.saving);jQuery.post(ajaxurl,{action:"set-post-thumbnail",post_id:post_id,thumbnail_id:id,cookie:encodeURIComponent(document.cookie)},function(str){var win=window.dialogArguments||opener||parent||top;$link.text(setPostThumbnailL10n.setThumbnail);if(str=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").show();$link.text(setPostThumbnailL10n.done);$link.fadeOut(2000);win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str)}})};
|
|
@ -382,7 +382,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20091111' );
|
||||
$scripts->add_data( 'image-edit', 'group', 1 );
|
||||
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091210' );
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091210b' );
|
||||
$scripts->add_data( 'set-post-thumbnail', 'group', 1 );
|
||||
$scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
|
||||
'setThumbnail' => __( 'Use as thumbnail' ),
|
||||
|
|
Loading…
Reference in New Issue