From 637badfbd6a9180e718f79a31f29338e5a8920a5 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 19 Apr 2012 09:52:36 +0000 Subject: [PATCH] in manage users, allow for displaying guests, but not robots - should fix #720, but can't be tested locally --- static/js/pandora/usersDialog.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/usersDialog.js b/static/js/pandora/usersDialog.js index cf9a0f185..9cbece380 100644 --- a/static/js/pandora/usersDialog.js +++ b/static/js/pandora/usersDialog.js @@ -37,10 +37,25 @@ pandora.ui.usersDialog = function() { }), $guestsCheckbox = Ox.Checkbox({ - title: 'Include Guests & Robots', + title: 'Include Guests', value: false }) - .css({float: 'left', margin: '4px 4px 4px 2px'}) + .css({float: 'left', margin: '4px 2px 4px 2px'}) + .bindEvent({ + change: function(data) { + data.value + ? $robotsCheckbox.show() + : $robotsCheckbox.hide().options({value: false}); + updateList(); + } + }), + + $robotsCheckbox = Ox.Checkbox({ + title: 'Include Robots', + value: false + }) + .css({float: 'left', margin: '4px 2px 4px 2px'}) + .hide() .bindEvent({ change: updateList }), @@ -435,6 +450,7 @@ pandora.ui.usersDialog = function() { element: Ox.Bar({size: 24}) .append($reloadButton) .append($guestsCheckbox) + .append($robotsCheckbox) .append($findElement), size: 24 }, @@ -939,6 +955,7 @@ pandora.ui.usersDialog = function() { function updateList() { var guests = $guestsCheckbox.value(), + robots = $robotsCheckbox.value(), key = $findSelect.value(), value = $findInput.value(), query = { @@ -947,10 +964,10 @@ pandora.ui.usersDialog = function() { key != 'email' ? [{key: 'username', value: value, operator: '='}] : [], key != 'username' ? [{key: 'email', value: value, operator: '='}] : [] ) - : !guests ? [ - {key: 'level', value: 'guest', operator: '!='}, - {key: 'level', value: 'robot', operator: '!='} - ] : [], + : Ox.merge( + !guests ? [{key: 'level', value: 'guest', operator: '!='}] : [], + !robots ? [{key: 'level', value: 'robot', operator: '!='}] : [] + ), operator: key == 'all' && value ? '|' : '&' }; $list.options({