update documents panel and dialog

This commit is contained in:
rolux 2014-01-07 14:29:12 +00:00
parent e3ca70c9ea
commit b9b5a0d5b3
2 changed files with 35 additions and 10 deletions

View file

@ -40,8 +40,7 @@ pandora.ui.documentDialog = function(options) {
});
},
pandora_document: function(data) {
Ox.print('DOCUMENT', data)
if (data.value.length) {
if (data.value) {
if (Ox.getObjectById(items, data.value)) {
} else {
@ -68,6 +67,7 @@ pandora.ui.documentDialog = function(options) {
right: '4px',
top: '4px'
})
[items.length > 1 ? 'show' : 'hide']()
.bindEvent({
click: function(data) {
options.index = Ox.mod(
@ -89,7 +89,12 @@ pandora.ui.documentDialog = function(options) {
$content.replaceWith(
$content = (
item.extension == 'pdf'
? Ox.Element()
? Ox.PDFViewer({
height: dialogHeight,
url: '/documents/' + item.id + '/'
+ item.name + '.' + item.extension,
width: dialogWidth
})
: Ox.ImageViewer({
height: dialogHeight,
imageHeight: item.dimensions[1],

View file

@ -114,7 +114,7 @@ pandora.ui.documentsPanel = function(options) {
.bindEvent({
click: function() {
if (isItemView) {
editDocuments();
} else {
}
@ -265,8 +265,16 @@ pandora.ui.documentsPanel = function(options) {
})
.css({float: 'left', margin: '4px'})
.bindEvent({
click: function() {
click: function(data) {
if (data.id == 'open') {
openDocuments();
} else if (data.id == 'edit') {
editDocuments();
} else if (data.id == 'remove') {
removeDocuments();
} else if (data.id == 'delete') {
deleteDocuments();
}
}
})
.appendTo($itemBar),
@ -318,7 +326,6 @@ pandora.ui.documentsPanel = function(options) {
overflow: 'hidden',
textOverflow: 'ellipsis'
})
.html(Ox._('No document selected'))
.appendTo($itemStatusbar),
$itemPanel = Ox.SplitPanel({
@ -338,7 +345,7 @@ pandora.ui.documentsPanel = function(options) {
ui.documentSize = 0;
pandora.UI.set({documentSize: data.size});
},
toggle: function() {
toggle: function(data) {
pandora.UI.set({showDocument: !data.collapsed});
}
}),
@ -350,11 +357,13 @@ pandora.ui.documentsPanel = function(options) {
},
{
collapsible: isItemView,
collapsed: !ui.showDocument,
collapsed: isItemView && !ui.showDocument,
element: $itemPanel,
size: ui.documentSize,
resizable: true,
resize: [192, 256, 320, 384]
resize: [192, 256, 320, 384],
tooltip: 'document <span class="OxBright">'
+ Ox.SYMBOLS.SHIFT + 'D</span>'
}
],
orientation: 'horizontal'
@ -366,6 +375,9 @@ pandora.ui.documentsPanel = function(options) {
},
pandora_documentsview: function(data) {
$listPanel.replaceElement(1, $list = renderList());
},
pandora_showdocument: function(data) {
isItemView && that.toggle(1);
}
});
@ -596,6 +608,9 @@ pandora.ui.documentsPanel = function(options) {
+ ', ' + Ox.formatValue(data.size, 'B')
);
},
key_escape: function() {
pandora.UI.set({document: ''});
},
open: openDocuments,
openpreview: openDocuments,
select: function(data) {
@ -664,6 +679,11 @@ pandora.ui.documentsPanel = function(options) {
$preview = renderPreview().appendTo($item);
$form = renderForm().appendTo($item);
}
$itemStatus.html(
selected.length
? Ox.formatCount(selected.length, 'Document')
: Ox._('No document selected')
);
}
function updateList() {