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:
Ryan Boren
2008-09-04 17:53:14 +00:00
parent bc27b345eb
commit 3bcb702d2d
3 changed files with 31 additions and 28 deletions
+18 -5
View File
@@ -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')}
);
}
});