in manage users, allow for displaying guests, but not robots - should fix #720, but can't be tested locally

This commit is contained in:
rolux 2012-04-19 09:52:36 +00:00
parent fbadfec8f6
commit 637badfbd6

View file

@ -37,10 +37,25 @@ pandora.ui.usersDialog = function() {
}), }),
$guestsCheckbox = Ox.Checkbox({ $guestsCheckbox = Ox.Checkbox({
title: 'Include Guests & Robots', title: 'Include Guests',
value: false 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({ .bindEvent({
change: updateList change: updateList
}), }),
@ -435,6 +450,7 @@ pandora.ui.usersDialog = function() {
element: Ox.Bar({size: 24}) element: Ox.Bar({size: 24})
.append($reloadButton) .append($reloadButton)
.append($guestsCheckbox) .append($guestsCheckbox)
.append($robotsCheckbox)
.append($findElement), .append($findElement),
size: 24 size: 24
}, },
@ -939,6 +955,7 @@ pandora.ui.usersDialog = function() {
function updateList() { function updateList() {
var guests = $guestsCheckbox.value(), var guests = $guestsCheckbox.value(),
robots = $robotsCheckbox.value(),
key = $findSelect.value(), key = $findSelect.value(),
value = $findInput.value(), value = $findInput.value(),
query = { query = {
@ -947,10 +964,10 @@ pandora.ui.usersDialog = function() {
key != 'email' ? [{key: 'username', value: value, operator: '='}] : [], key != 'email' ? [{key: 'username', value: value, operator: '='}] : [],
key != 'username' ? [{key: 'email', value: value, operator: '='}] : [] key != 'username' ? [{key: 'email', value: value, operator: '='}] : []
) )
: !guests ? [ : Ox.merge(
{key: 'level', value: 'guest', operator: '!='}, !guests ? [{key: 'level', value: 'guest', operator: '!='}] : [],
{key: 'level', value: 'robot', operator: '!='} !robots ? [{key: 'level', value: 'robot', operator: '!='}] : []
] : [], ),
operator: key == 'all' && value ? '|' : '&' operator: key == 'all' && value ? '|' : '&'
}; };
$list.options({ $list.options({