From 805bdb93659de9ac31a7a32124e8c2fe1b498576 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 10 Dec 2009 08:03:26 +0000 Subject: [PATCH] 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 --- wp-admin/includes/media.php | 2 +- wp-admin/js/set-post-thumbnail.dev.js | 2 +- wp-admin/js/set-post-thumbnail.js | 2 +- wp-includes/script-loader.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 4b9e41330d..c81e2cbc36 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -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 = "" . esc_html__( "Use as thumbnail" ) . ""; + $thumbnail = "" . esc_html__( "Use as thumbnail" ) . ""; if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) ) $form_fields['buttons'] = array('tr' => "\t\t$send $thumbnail $delete\n"); diff --git a/wp-admin/js/set-post-thumbnail.dev.js b/wp-admin/js/set-post-thumbnail.dev.js index d8ea68b1db..508577fc8e 100644 --- a/wp-admin/js/set-post-thumbnail.dev.js +++ b/wp-admin/js/set-post-thumbnail.dev.js @@ -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, { diff --git a/wp-admin/js/set-post-thumbnail.js b/wp-admin/js/set-post-thumbnail.js index 6ba67ee24c..a2c63af42f 100644 --- a/wp-admin/js/set-post-thumbnail.js +++ b/wp-admin/js/set-post-thumbnail.js @@ -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)}})}; \ No newline at end of file +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)}})}; \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 058b40b1bc..1262822c58 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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' ),