2 * @brief Javascript for the admin module
5 $('body').on('click', '.selectall', function() {
6 selectall($(this).data('selectAll'));
8 $('body').on('click', '.selectnone', function() {
9 selectnone($(this).data('selectNone'));
12 // Toggle checkbox status to all or none for all checkboxes of a specific
14 $('body').on('change', 'input[type=checkbox].selecttoggle', function() {
16 if ($this.prop('checked')) {
17 selectall($this.data('selectClass'));
18 $this.attr('title', $this.data('selectNone'));
20 selectnone($this.data('selectClass'));
21 $this.attr('title', $this.data('selectAll'));
25 // Use AJAX calls to reorder the table (so we don't need to reload the page).
26 $('body').on('click', '.table-order', function(e) {
29 // Get the parent table element.
30 var table = $(this).parents('table');
31 var orderUrl = this.getAttribute("data-order-url");
32 table.fadeTo("fast", 0.33);
34 $("body").css("cursor", "wait");
36 $.get(orderUrl, function(data) {
37 // Find the table element in the html we got.
38 var result = $(data).find('#' + table[0].id);
39 // And add the new table html to the parent.
40 $(table).parent().html(result);
42 $("body").css("cursor", "auto");
46 function selectall(cls) {
47 $('.' + cls).prop('checked', true);
50 function selectnone(cls) {
51 $('.' + cls).prop('checked', false);
59 function confirm_delete(msg, uname){
60 return confirm(msg.format(uname));
63 function details(uid) {
64 $("#user-" + uid + "-detail").toggleClass("hidden");
65 $("#user-" + uid).toggleClass("opened");