update dimensions replacing documents, add modified to image urls to get latest version
This commit is contained in:
parent
6f9fb06da3
commit
54b7c4be9a
3 changed files with 8 additions and 4 deletions
|
@ -359,6 +359,8 @@ def upload(request):
|
||||||
file.uploading = True
|
file.uploading = True
|
||||||
name, extension = request.POST['filename'].rsplit('.', 1)
|
name, extension = request.POST['filename'].rsplit('.', 1)
|
||||||
file.extension = extension
|
file.extension = extension
|
||||||
|
file.width = -1
|
||||||
|
file.pages = -1
|
||||||
file.save()
|
file.save()
|
||||||
upload_url = request.build_absolute_uri('/api/upload/document?id=%s' % file.get_id())
|
upload_url = request.build_absolute_uri('/api/upload/document?id=%s' % file.get_id())
|
||||||
return render_to_json_response({
|
return render_to_json_response({
|
||||||
|
|
|
@ -19,7 +19,7 @@ pandora.openDocumentDialog = function(options) {
|
||||||
operator: '|'
|
operator: '|'
|
||||||
},
|
},
|
||||||
range: [0, options.ids.length],
|
range: [0, options.ids.length],
|
||||||
keys: ['description', 'dimensions', 'extension', 'id', 'name']
|
keys: ['description', 'dimensions', 'extension', 'id', 'name', 'modified']
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
var i = 0,
|
var i = 0,
|
||||||
documents = Ox.sort(result.data.items, function(item) {
|
documents = Ox.sort(result.data.items, function(item) {
|
||||||
|
@ -183,9 +183,9 @@ pandora.ui.documentDialog = function(options) {
|
||||||
: [],
|
: [],
|
||||||
height: dialogHeight,
|
height: dialogHeight,
|
||||||
imageHeight: item.dimensions[1],
|
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 + '/'
|
imageURL: pandora.getMediaURL('/documents/' + item.id + '/'
|
||||||
+ item.name + '.' + item.extension),
|
+ item.name + '.' + item.extension + '?' + item.modified),
|
||||||
imageWidth: item.dimensions[0],
|
imageWidth: item.dimensions[0],
|
||||||
width: dialogWidth
|
width: dialogWidth
|
||||||
})
|
})
|
||||||
|
|
|
@ -520,6 +520,7 @@ pandora.ui.documentsPanel = function(options) {
|
||||||
$list.bindEventOnce({
|
$list.bindEventOnce({
|
||||||
load: function() {
|
load: function() {
|
||||||
$list.options({selected: files.ids});
|
$list.options({selected: files.ids});
|
||||||
|
selectDocuments();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.reloadList();
|
.reloadList();
|
||||||
|
@ -915,8 +916,9 @@ pandora.ui.documentsPanel = function(options) {
|
||||||
|
|
||||||
function renderPreview() {
|
function renderPreview() {
|
||||||
var selected = $list.options('selected')[0],
|
var selected = $list.options('selected')[0],
|
||||||
|
modified = $list.value(selected, 'modified'),
|
||||||
size = getPreviewSize(),
|
size = getPreviewSize(),
|
||||||
src = '/documents/' + selected + '/256p.jpg',
|
src = '/documents/' + selected + '/256p.jpg?' + modified,
|
||||||
$element = Ox.ImageElement({
|
$element = Ox.ImageElement({
|
||||||
height: size.height,
|
height: size.height,
|
||||||
src: src,
|
src: src,
|
||||||
|
|
Loading…
Reference in a new issue