From d8499cb8dec01edf355549318ad514a3288bdc32 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 13 Feb 2014 08:50:48 +0000 Subject: [PATCH] fix #2294 (Implement 'Add Documents to Selected Movies') --- static/js/documentsPanel.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index 0a71abe5..01d2a751 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -6,6 +6,7 @@ pandora.ui.documentsPanel = function(options) { var ui = pandora.user.ui, hasItemView = ui.section == 'items' && ui.item, + hasListSelection = ui.section == 'items' && !ui.item && ui.listSelection.length, isItemView = options.isItemView, listLoaded = false, @@ -400,11 +401,11 @@ pandora.ui.documentsPanel = function(options) { function addDocuments() { var ids = ui.documentsSelection['']; pandora.api.addDocument({ - item: ui.item, + item: hasItemView ? ui.item : ui.listSelection, ids: ids }, function() { Ox.Request.clearCache(); - if (ui.itemView == 'documents') { + if (ui.item && ui.itemView == 'documents') { // FIXME: $list.reloadList() would be much better pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = pandora.ui.item() @@ -804,13 +805,15 @@ pandora.ui.documentsPanel = function(options) { [selected.length ? 'enableItem' : 'disableItem']('embed') [selected.length ? 'enableItem' : 'disableItem']('remove'); } else { - $itemMenu.setItemTitle('add', Ox._( - 'Add ' + string + ' to Current ' - + pandora.site.itemName.singular - )) + $itemMenu.setItemTitle('add', Ox._('Add ' + string + ' to ' + ( + hasListSelection ? 'Selected' : 'Current' + ) + ' {0}', [pandora.site.itemName[ + hasListSelection && ui.listSelection.length > 1 + ? 'plural' : 'singular' + ]])) .setItemTitle('replace', Ox._('Replace ' + 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 == 1 ? 'enableItem' : 'disableItem']('replace') [selected.length ? 'enableItem' : 'disableItem']('delete');