From 54b7c4be9a59f239695f8dec19b4fde7b6234ab8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 26 Oct 2015 16:10:12 +0100 Subject: [PATCH] update dimensions replacing documents, add modified to image urls to get latest version --- pandora/document/views.py | 2 ++ static/js/documentDialog.js | 6 +++--- static/js/documentsPanel.js | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pandora/document/views.py b/pandora/document/views.py index 6ffb2ffa..c2af5b46 100644 --- a/pandora/document/views.py +++ b/pandora/document/views.py @@ -359,6 +359,8 @@ def upload(request): file.uploading = True name, extension = request.POST['filename'].rsplit('.', 1) file.extension = extension + file.width = -1 + file.pages = -1 file.save() upload_url = request.build_absolute_uri('/api/upload/document?id=%s' % file.get_id()) return render_to_json_response({ diff --git a/static/js/documentDialog.js b/static/js/documentDialog.js index 1705b5ce..84106fb1 100644 --- a/static/js/documentDialog.js +++ b/static/js/documentDialog.js @@ -19,7 +19,7 @@ pandora.openDocumentDialog = function(options) { operator: '|' }, range: [0, options.ids.length], - keys: ['description', 'dimensions', 'extension', 'id', 'name'] + keys: ['description', 'dimensions', 'extension', 'id', 'name', 'modified'] }, function(result) { var i = 0, documents = Ox.sort(result.data.items, function(item) { @@ -183,9 +183,9 @@ pandora.ui.documentDialog = function(options) { : [], height: dialogHeight, imageHeight: item.dimensions[1], - imagePreviewURL: pandora.getMediaURL('/documents/' + item.id + '/256p.jpg'), + imagePreviewURL: pandora.getMediaURL('/documents/' + item.id + '/256p.jpg?' + item.modified), imageURL: pandora.getMediaURL('/documents/' + item.id + '/' - + item.name + '.' + item.extension), + + item.name + '.' + item.extension + '?' + item.modified), imageWidth: item.dimensions[0], width: dialogWidth }) diff --git a/static/js/documentsPanel.js b/static/js/documentsPanel.js index 8a7baee7..b69ffa5d 100644 --- a/static/js/documentsPanel.js +++ b/static/js/documentsPanel.js @@ -520,6 +520,7 @@ pandora.ui.documentsPanel = function(options) { $list.bindEventOnce({ load: function() { $list.options({selected: files.ids}); + selectDocuments(); } }) .reloadList(); @@ -915,8 +916,9 @@ pandora.ui.documentsPanel = function(options) { function renderPreview() { var selected = $list.options('selected')[0], + modified = $list.value(selected, 'modified'), size = getPreviewSize(), - src = '/documents/' + selected + '/256p.jpg', + src = '/documents/' + selected + '/256p.jpg?' + modified, $element = Ox.ImageElement({ height: size.height, src: src,