documents panel: add missing localization, select items on add, fix delete in item view (remove)

This commit is contained in:
rolux 2014-01-18 01:20:31 +00:00
parent aad6d26a44
commit 03feac7b4b

View file

@ -250,7 +250,7 @@ pandora.ui.documentsPanel = function(options) {
{id: 'delete', title: '', keyboard: 'delete'} {id: 'delete', title: '', keyboard: 'delete'}
], ],
title: 'set', title: 'set',
tooltip: 'Options', tooltip: Ox._('Options'),
type: 'image' type: 'image'
}) })
.css({float: 'left', margin: '4px'}) .css({float: 'left', margin: '4px'})
@ -387,17 +387,21 @@ pandora.ui.documentsPanel = function(options) {
); );
function addDocuments() { function addDocuments() {
var ids = ui.documentsSelection[''];
pandora.api.addDocument({ pandora.api.addDocument({
item: ui.item, item: ui.item,
ids: ui.documentsSelection[''] ids: ids
}, function() { }, function() {
Ox.Request.clearCache(); Ox.Request.clearCache();
if (ui.itemView == 'documents') { if (ui.itemView == 'documents') {
//fixme just upload list here // FIXME: $list.reloadList() would be much better
//self.$documentsList.reloadList();
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.item = pandora.ui.item() pandora.$ui.item = pandora.ui.item()
); );
// FIXME: there has to be a way to do this without timeout
setTimeout(function() {
pandora.UI.set('documentsSelection.' + ui.item, ids);
}, 1000);
} }
}); });
} }
@ -686,7 +690,7 @@ pandora.ui.documentsPanel = function(options) {
isItemView && openDocumentsDialog(); isItemView && openDocumentsDialog();
}, },
closepreview: closeDocuments, closepreview: closeDocuments,
'delete': deleteDocuments, 'delete': isItemView ? removeDocuments : deleteDocuments,
init: function(data) { init: function(data) {
$listStatus.html( $listStatus.html(
Ox.toTitleCase(Ox.formatCount(data.items, 'document')) Ox.toTitleCase(Ox.formatCount(data.items, 'document'))
@ -722,7 +726,9 @@ pandora.ui.documentsPanel = function(options) {
return Ox.ImageElement({ return Ox.ImageElement({
height: size.height, height: size.height,
src: src, src: src,
tooltip: 'Click to open document', // fixme: this tends to stick around after menu click
// (and may not be necessary in the first place)
// tooltip: Ox._('Click to open document'),
width: size.width width: size.width
}) })
.css({ .css({