documents panel: add fixme; hide select/deselect buttons on load

This commit is contained in:
rolux 2014-02-03 09:31:25 +05:30
parent c0c642bea5
commit 6336b3cc8e

View file

@ -290,6 +290,7 @@ pandora.ui.documentsPanel = function(options) {
); );
} }
}) })
.hide()
.appendTo($itemBar), .appendTo($itemBar),
$selectButton = Ox.ButtonGroup({ $selectButton = Ox.ButtonGroup({
@ -316,6 +317,7 @@ pandora.ui.documentsPanel = function(options) {
} }
} }
}) })
.hide()
.appendTo($itemBar), .appendTo($itemBar),
$item = Ox.Element().css({overflowY: 'scroll'}), $item = Ox.Element().css({overflowY: 'scroll'}),
@ -799,6 +801,7 @@ pandora.ui.documentsPanel = function(options) {
} }
function selectDocuments() { function selectDocuments() {
// FIXME: this looks wrong - will produce inconsistent state
if(!listLoaded) { if(!listLoaded) {
return; return;
} }
@ -809,22 +812,22 @@ pandora.ui.documentsPanel = function(options) {
[selected.length > 0 ? 'enableItem' : 'disableItem']('open'); [selected.length > 0 ? 'enableItem' : 'disableItem']('open');
if (isItemView) { if (isItemView) {
$itemMenu.setItemTitle('edit', Ox._('Edit ' + string + '...')) $itemMenu.setItemTitle('edit', Ox._('Edit ' + string + '...'))
.setItemTitle('remove', Ox._( .setItemTitle('remove', Ox._(
'Remove ' + string + ' from ' 'Remove ' + string + ' from '
+ pandora.site.itemName.singular + pandora.site.itemName.singular
)) ))
[selected.length > 0 ? 'enableItem' : 'disableItem']('edit') [selected.length > 0 ? 'enableItem' : 'disableItem']('edit')
[selected.length > 0 ? 'enableItem' : 'disableItem']('remove'); [selected.length > 0 ? 'enableItem' : 'disableItem']('remove');
} else { } else {
$itemMenu.setItemTitle('add', Ox._( $itemMenu.setItemTitle('add', Ox._(
'Add ' + string + ' to Current ' 'Add ' + string + ' to Current '
+ pandora.site.itemName.singular + pandora.site.itemName.singular
)) ))
.setItemTitle('replace', Ox._('Replace ' + string + '...')) .setItemTitle('replace', Ox._('Replace ' + string + '...'))
.setItemTitle('delete', Ox._('Delete ' + string + '...')) .setItemTitle('delete', Ox._('Delete ' + string + '...'))
[selected.length > 0 ? 'enableItem' : 'disableItem']('add') [selected.length > 0 ? 'enableItem' : 'disableItem']('add')
[selected.length == 1 ? 'enableItem' : 'disableItem']('replace') [selected.length == 1 ? 'enableItem' : 'disableItem']('replace')
[selected.length > 0 ? 'enableItem' : 'disableItem']('delete'); [selected.length > 0 ? 'enableItem' : 'disableItem']('delete');
} }
$selectButton[selected.length > 1 ? 'show' : 'hide'](); $selectButton[selected.length > 1 ? 'show' : 'hide']();
$deselectButton[selected.length ? 'show' : 'hide'](); $deselectButton[selected.length ? 'show' : 'hide']();