From bf3bb604fa82e0738fdb21d9bd4fd07000ed35bd Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 16 Aug 2016 18:05:29 +0200 Subject: [dozmod] Implement action log subpage --- modules-available/dozmod/templates/userlist.html | 34 ++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'modules-available/dozmod/templates/userlist.html') diff --git a/modules-available/dozmod/templates/userlist.html b/modules-available/dozmod/templates/userlist.html index 79d4848b..7dd84fd4 100644 --- a/modules-available/dozmod/templates/userlist.html +++ b/modules-available/dozmod/templates/userlist.html @@ -22,7 +22,7 @@ {{#users}} - {{lastname}}, {{firstname}} + {{lastname}}, {{firstname}} {{orgname}} {{lastlogin}} {{email}} @@ -44,29 +44,35 @@ function setu(action, el, uid) { var v = el.checked ? '1' : '0'; var old = el.checked == true; box.css('display', 'none'); - $.post('?do=DozMod', { token: TOKEN, action: action, userid: uid, value: v }).done(function (data) { - if (data != 1 && data != 0) { + $.post('?do=DozMod', { token: TOKEN, section: 'users', action: action, userid: uid, value: v }).done(function (data) { + + if (data !== '1' && data !== '0') { el.checked = !old; box.parent().css('background-color', 'red !important'); } else { el.checked = (data == 1); + box.parent().css('background-color', ''); + /* show success notification */ + $notification = $('') + .addClass('glyphicon glyphicon-saved') + .css('color', '#2ecc71') + .css('width', '0px') + .css('position', 'relative') + .css('right', '20px') + .hide(); + box.before($notification); + $notification.fadeIn('fast', function () { + $notification.fadeOut('slow', function () { $notification.remove() }); + }); } - /* show success notification */ - $notification = $('') - .addClass('glyphicon glyphicon-saved') - .css('color', '#2ecc71') - .css('width', '0px') - .css('position', 'relative') - .css('right', '20px') - .hide(); - box.before($notification); - $notification.fadeIn('slow', function () {$notification.fadeOut('fast');}); - box.css('display', ''); + }).fail(function() { + el.checked = !old; box.parent().css('background-color', 'red !important'); box.css('display', ''); + }); } -- cgit v1.2.3-55-g7522