2 * Javascript for the admin module
6 $body.on('click', '.selectall', function() {
7 selectall($(this).data('selectAll'));
9 $body.on('click', '.selectnone', function() {
10 selectnone($(this).data('selectNone'));
13 // Toggle checkbox status to all or none for all checkboxes of a specific
15 $body.on('change', 'input[type=checkbox].selecttoggle', function() {
17 if ($this.prop('checked')) {
18 selectall($this.data('selectClass'));
19 $this.attr('title', $this.data('selectNone'));
21 selectnone($this.data('selectClass'));
22 $this.attr('title', $this.data('selectAll'));
26 // Use AJAX calls to reorder the table (so we don't need to reload the page).
27 $body.on('click', '.table-order', function(e) {
30 // Get the parent table element.
31 var table = $(this).parents('table');
32 var orderUrl = this.getAttribute("data-order-url");
33 table.fadeTo("fast", 0.33);
35 $body.css("cursor", "wait");
37 $.get(orderUrl, function(data) {
38 // Find the table element in the html we got.
39 var result = $(data).find('#' + table[0].id);
40 // And add the new table html to the parent.
41 $(table).replaceWith(result);
43 $body.css("cursor", "auto");
47 function selectall(cls) {
48 $('.' + cls).prop('checked', true);
51 function selectnone(cls) {
52 $('.' + cls).prop('checked', false);
60 function confirm_delete(msg, uname){
61 return confirm(msg.format(uname));
64 function details(uid) {
65 $("#user-" + uid + "-detail").toggleClass("hidden");
66 $("#user-" + uid).toggleClass("opened");