'use strict';
pandora.ui.allItems = function(section) {
// FIXME: Why is this not a list?
section = section || pandora.user.ui.section;
var canAddItems = !pandora.site.itemRequiresVideo && pandora.hasCapability('canAddItems'),
canUploadVideo = pandora.hasCapability('canAddItems'),
canAddDocuments = pandora.hasCapability('canAddDocuments'),
isSelected = pandora.user.ui._list || pandora.user.ui._collection,
that = Ox.Element()
.addClass('OxSelectableElement' + (isSelected ? '' : ' OxSelected'))
.css({
height: '16px',
cursor: 'default',
overflow: 'hidden'
})
.on({
click: function() {
that.gainFocus();
if (section == 'items') {
pandora.UI.set({
find: {conditions: [], operator: '&'},
item: ''
});
} else if (section == 'documents') {
pandora.UI.set({
findDocuments: {conditions: [], operator: '&'},
document: ''
});
} else {
pandora.UI.set(section.slice(0, -1), '');
}
}
})
.bindEvent({
pandora_document: updateSelected,
pandora_finddocuments: updateSelected,
pandora_edit: updateSelected,
pandora_find: updateSelected,
pandora_section: updateSelected,
pandora_text: updateSelected
}),
$icon = $('')
.attr({src: '/static/png/icon.png'})
.css({float: 'left', width: '14px', height: '14px', margin: '1px'})
.appendTo(that),
$name = $('