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, var dialogHeight = Math.round((window.innerHeight - 48) * 0.9) + 24,
dialogWidth = Math.round(window.innerWidth * 0.9), dialogWidth = Math.round(window.innerWidth * 0.9),
isItemView = !pandora.$ui.documentsDialog,
items = options.items, items = options.items,
item = items[options.index], item = items[options.index],
settings = getSettings(), settings = getSettings(),
@ -125,10 +126,11 @@ pandora.ui.documentDialog = function(options) {
[items.length > 1 ? 'show' : 'hide']() [items.length > 1 ? 'show' : 'hide']()
.bindEvent({ .bindEvent({
click: function(data) { click: function(data) {
options.index = Ox.mod( var offset = data.id == 'previous' ? -1 : 1;
options.index + (data.id == 'previous' ? -1 : 1), options.index = Ox.mod(options.index + offset, items.length);
items.length pandora.$ui[
); isItemView ? 'documents' : 'documentsDialogPanel'
].selectSelected(offset);
pandora.UI.set({document: items[options.index].id}); pandora.UI.set({document: items[options.index].id});
} }
}); });

View file

@ -58,6 +58,8 @@ pandora.ui.documentsDialog = function() {
that.close = function() { that.close = function() {
Ox.Request.clearCache('findDocuments'); Ox.Request.clearCache('findDocuments');
that.superClose(); that.superClose();
// needed in documentDialog to determine if isItemView
delete pandora.$ui.documentsDialog;
}; };
return that; return that;

View file

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