mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Bulk action hot keys for comments. Props nbachiyski. see #7643
git-svn-id: https://develop.svn.wordpress.org/trunk@8804 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -243,13 +243,26 @@ $(document).ready(function(){
|
||||
if (l.length)
|
||||
window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
|
||||
}
|
||||
};
|
||||
var edit_comment = function(event, current_row) {
|
||||
window.location = $('span.edit a', current_row).attr('href');
|
||||
};
|
||||
var toggle_all = function() {
|
||||
var master_checkbox = $('form#comments-form .check-column :checkbox:first');
|
||||
master_checkbox.attr('checked', master_checkbox.attr('checked')? '' : 'checked');
|
||||
checkAll('form#comments-form');
|
||||
}
|
||||
$.table_hotkeys($('table.widefat'), ['a', 'u', 's', 'd', 'r'],
|
||||
{ highlight_first: adminCommentsL10n.hotkeys_highlight_first,
|
||||
highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||
prev_page_link_cb: make_hotkeys_redirect('prev'),
|
||||
next_page_link_cb: make_hotkeys_redirect('next'),
|
||||
var make_bulk = function(value) {
|
||||
return function(event, _) {
|
||||
$('option[value='+value+']').attr('selected', 'selected');
|
||||
$('form#comments-form')[0].submit();
|
||||
}
|
||||
};
|
||||
$.table_hotkeys($('table.widefat'),['a', 'u', 's', 'd', 'r', ['e', edit_comment],
|
||||
['shift+a', make_bulk('approve')], ['shift+s', make_bulk('markspam')],
|
||||
['shift+d', make_bulk('delete')], ['shift+x', toggle_all]],
|
||||
{highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
|
||||
prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next')}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,4 +23,4 @@ jQuery( function($) {
|
||||
$( 'thead :checkbox' ).click( function() {
|
||||
checkAll( $(this).parents( 'form:first' ) );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user