From d91401189cf34747fb835538c119ea0ff9307858 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 13 Feb 2014 12:07:28 +0000 Subject: [PATCH] fix #2165 (Document Viewer Dialog: previous/next buttons not functional) --- static/js/documentDialog.js | 10 ++++++---- static/js/documentsDialog.js | 2 ++ static/js/documentsPanel.js | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) 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(); };