Do not run bulk edit when the user clicks on a filter, fixes #17733

git-svn-id: https://develop.svn.wordpress.org/trunk@18222 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2011-06-10 00:01:16 +00:00
parent 1acc61df32
commit fc4915fb0f
7 changed files with 24 additions and 18 deletions

View File

@ -120,6 +120,7 @@ if ( $doaction ) {
$sendback = add_query_arg('deleted', $deleted, $sendback);
break;
case 'edit':
if ( isset($_REQUEST['bulk_edit']) ) {
$done = bulk_edit_posts($_REQUEST);
if ( is_array($done) ) {
@ -128,6 +129,7 @@ if ( $doaction ) {
$done['locked'] = count( $done['locked'] );
$sendback = add_query_arg( $done, $sendback );
}
}
break;
}

View File

@ -288,8 +288,13 @@ class WP_List_Table {
echo "<select name='action$two'>\n";
echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
foreach ( $this->_actions as $name => $title )
echo "\t<option value='$name'>$title</option>\n";
foreach ( $this->_actions as $name => $title ) {
$class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
echo "\t<option value='$name'$class>$title</option>\n";
}
echo "</select>\n";
submit_button( __( 'Apply' ), 'button-secondary action', false, false, array( 'id' => "doaction$two" ) );

View File

@ -74,9 +74,9 @@ inlineEditPost = {
}
});
$('#post-query-submit').click(function(e){
if ( $('form#posts-filter tr.inline-editor').length > 0 )
$('#post-query-submit').mousedown(function(e){
t.revert();
$('select[name^="action"]').val('-1');
});
},

File diff suppressed because one or more lines are too long

View File

@ -20,8 +20,7 @@ inlineEditTax = {
$('a.save', row).click(function() { return inlineEditTax.save(this); });
$('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); });
$('#posts-filter input[type="submit"]').click(function(e){
if ( $('form#posts-filter tr.inline-editor').length > 0 )
$('#posts-filter input[type="submit"]').mousedown(function(e){
t.revert();
});
},

View File

@ -1 +1 @@
(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("class").substr(5);b.what="#"+b.type+"-";a(".editinline").live("click",function(){inlineEditTax.edit(this);return false});c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});a('#posts-filter input[type="submit"]').click(function(d){if(a("form#posts-filter tr.inline-editor").length>0){b.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(e){var d,b,c=a('input[name="taxonomy"]').val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save-tax",tax_type:this.type,tax_ID:e,taxonomy:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(g){var h,f;a("table.widefat .inline-edit-save .waiting").hide();if(g){if(-1!=g.indexOf("<tr")){a(inlineEditTax.what+e).remove();f=a(g).attr("id");a("#edit-"+e).before(g).remove();h=f?a("#"+f):a(inlineEditTax.what+e);h.hide().fadeIn()}else{a("#edit-"+e+" .inline-edit-save .error").html(g).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery);
(function(a){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("class").substr(5);b.what="#"+b.type+"-";a(".editinline").live("click",function(){inlineEditTax.edit(this);return false});c.keyup(function(d){if(d.which==27){return inlineEditTax.revert()}});a("a.cancel",c).click(function(){return inlineEditTax.revert()});a("a.save",c).click(function(){return inlineEditTax.save(this)});a("input, select",c).keydown(function(d){if(d.which==13){return inlineEditTax.save(this)}});a('#posts-filter input[type="submit"]').mousedown(function(d){b.revert()})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css("display")=="none"?b.revert():b.edit(c)},edit:function(d){var c=this,b;c.revert();if(typeof(d)=="object"){d=c.getId(d)}b=a("#inline-edit").clone(true),rowData=a("#inline_"+d);a("td",b).attr("colspan",a(".widefat:first thead th:visible").length);if(a(c.what+d).hasClass("alternate")){a(b).addClass("alternate")}a(c.what+d).hide().after(b);a(':input[name="name"]',b).val(a(".name",rowData).text());a(':input[name="slug"]',b).val(a(".slug",rowData).text());a(b).attr("id","edit-"+d).addClass("inline-editor").show();a(".ptitle",b).eq(0).focus();return false},save:function(e){var d,b,c=a('input[name="taxonomy"]').val()||"";if(typeof(e)=="object"){e=this.getId(e)}a("table.widefat .inline-edit-save .waiting").show();d={action:"inline-save-tax",tax_type:this.type,tax_ID:e,taxonomy:c};b=a("#edit-"+e+" :input").serialize();d=b+"&"+a.param(d);a.post("admin-ajax.php",d,function(g){var h,f;a("table.widefat .inline-edit-save .waiting").hide();if(g){if(-1!=g.indexOf("<tr")){a(inlineEditTax.what+e).remove();f=a(g).attr("id");a("#edit-"+e).before(g).remove();h=f?a("#"+f):a(inlineEditTax.what+e);h.hide().fadeIn()}else{a("#edit-"+e+" .inline-edit-save .error").html(g).show()}}else{a("#edit-"+e+" .inline-edit-save .error").html(inlineEditL10n.error).show()}});return false},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");if(b){a("table.widefat .inline-edit-save .waiting").hide();a("#"+b).remove();b=b.substr(b.lastIndexOf("-")+1);a(this.what+b).show()}return false},getId:function(c){var d=c.tagName=="TR"?c.id:a(c).parents("tr").attr("id"),b=d.split("-");return b[b.length-1]}};a(document).ready(function(){inlineEditTax.init()})})(jQuery);

View File

@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' );
$scripts->add_data( 'theme-preview', 'group', 1 );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20110605' );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20110609' );
$scripts->add_data( 'inline-edit-post', 'group', 1 );
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),
@ -394,7 +394,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
) );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20110512' );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20110609' );
$scripts->add_data( 'inline-edit-tax', 'group', 1 );
$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
'error' => __('Error while saving the changes.'),