diff --git a/static/js/documentDialog.js b/static/js/documentDialog.js index 4ab3be93c..83a129fde 100644 --- a/static/js/documentDialog.js +++ b/static/js/documentDialog.js @@ -59,6 +59,7 @@ pandora.ui.documentDialog = function(options) { var dialogHeight = Math.round((window.innerHeight - 48) * 0.9) + 24, dialogWidth = Math.round(window.innerWidth * 0.9), + isItemView = !pandora.$ui.documentsDialog, items = options.items, item = items[options.index], settings = getSettings(), @@ -125,10 +126,11 @@ pandora.ui.documentDialog = function(options) { [items.length > 1 ? 'show' : 'hide']() .bindEvent({ click: function(data) { - options.index = Ox.mod( - options.index + (data.id == 'previous' ? -1 : 1), - items.length - ); + var offset = data.id == 'previous' ? -1 : 1; + options.index = Ox.mod(options.index + offset, items.length); + pandora.$ui[ + isItemView ? 'documents' : 'documentsDialogPanel' + ].selectSelected(offset); pandora.UI.set({document: items[options.index].id}); } }); diff --git a/static/js/documentsDialog.js b/static/js/documentsDialog.js index 80cb73cbf..db77ef9a1 100644 --- a/static/js/documentsDialog.js +++ b/static/js/documentsDialog.js @@ -58,6 +58,8 @@ pandora.ui.documentsDialog = function() { that.close = function() { Ox.Request.clearCache('findDocuments'); that.superClose(); + // needed in documentDialog to determine if isItemView + delete pandora.$ui.documentsDialog; }; return that; diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index 01d2a751d..7488d20a1 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -886,6 +886,11 @@ pandora.ui.documentsPanel = function(options) { }).open(); } + that.selectSelected = function(offset) { + $list.selectSelected(offset); + return that; + }; + that.updateSize = function() { $list.size(); };