fix #2165 (Document Viewer Dialog: previous/next buttons not functional)

This commit is contained in:
rolux 2014-02-13 12:07:28 +00:00
parent f6b28485e1
commit d91401189c
3 changed files with 13 additions and 4 deletions

View File

@ -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});
}
});

View File

@ -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;

View File

@ -886,6 +886,11 @@ pandora.ui.documentsPanel = function(options) {
}).open();
}
that.selectSelected = function(offset) {
$list.selectSelected(offset);
return that;
};
that.updateSize = function() {
$list.size();
};