fix #2294 (Implement 'Add Documents to Selected Movies')

This commit is contained in:
rolux 2014-02-13 08:50:48 +00:00
parent d04269ccc1
commit d8499cb8de

View file

@ -6,6 +6,7 @@ pandora.ui.documentsPanel = function(options) {
var ui = pandora.user.ui, var ui = pandora.user.ui,
hasItemView = ui.section == 'items' && ui.item, hasItemView = ui.section == 'items' && ui.item,
hasListSelection = ui.section == 'items' && !ui.item && ui.listSelection.length,
isItemView = options.isItemView, isItemView = options.isItemView,
listLoaded = false, listLoaded = false,
@ -400,11 +401,11 @@ pandora.ui.documentsPanel = function(options) {
function addDocuments() { function addDocuments() {
var ids = ui.documentsSelection['']; var ids = ui.documentsSelection[''];
pandora.api.addDocument({ pandora.api.addDocument({
item: ui.item, item: hasItemView ? ui.item : ui.listSelection,
ids: ids ids: ids
}, function() { }, function() {
Ox.Request.clearCache(); Ox.Request.clearCache();
if (ui.itemView == 'documents') { if (ui.item && ui.itemView == 'documents') {
// FIXME: $list.reloadList() would be much better // FIXME: $list.reloadList() would be much better
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.item = pandora.ui.item() pandora.$ui.item = pandora.ui.item()
@ -804,13 +805,15 @@ pandora.ui.documentsPanel = function(options) {
[selected.length ? 'enableItem' : 'disableItem']('embed') [selected.length ? 'enableItem' : 'disableItem']('embed')
[selected.length ? 'enableItem' : 'disableItem']('remove'); [selected.length ? 'enableItem' : 'disableItem']('remove');
} else { } else {
$itemMenu.setItemTitle('add', Ox._( $itemMenu.setItemTitle('add', Ox._('Add ' + string + ' to ' + (
'Add ' + string + ' to Current ' hasListSelection ? 'Selected' : 'Current'
+ pandora.site.itemName.singular ) + ' {0}', [pandora.site.itemName[
)) hasListSelection && ui.listSelection.length > 1
? 'plural' : 'singular'
]]))
.setItemTitle('replace', Ox._('Replace ' + string + '...')) .setItemTitle('replace', Ox._('Replace ' + string + '...'))
.setItemTitle('delete', Ox._('Delete ' + string + '...')) .setItemTitle('delete', Ox._('Delete ' + string + '...'))
[selected.length && hasItemView ? 'enableItem' : 'disableItem']('add') [selected.length && (hasItemView || hasListSelection) ? 'enableItem' : 'disableItem']('add')
[selected.length ? 'enableItem' : 'disableItem']('embed') [selected.length ? 'enableItem' : 'disableItem']('embed')
[selected.length == 1 ? 'enableItem' : 'disableItem']('replace') [selected.length == 1 ? 'enableItem' : 'disableItem']('replace')
[selected.length ? 'enableItem' : 'disableItem']('delete'); [selected.length ? 'enableItem' : 'disableItem']('delete');