fix poster frames for new lists

This commit is contained in:
j 2019-07-14 11:33:38 +01:00
parent 686bd8c238
commit 1db88b4c96
3 changed files with 17 additions and 7 deletions

View file

@ -272,16 +272,16 @@ class Collection(models.Model):
for i in range(0, documents.count(), max(1, int(documents.count()/4))): for i in range(0, documents.count(), max(1, int(documents.count()/4))):
poster_frames.append({ poster_frames.append({
'document': documents[int(i)].get_id(), 'document': documents[int(i)].get_id(),
#'page': documents[int(i)]
}) })
self.poster_frames = tuple(poster_frames) self.poster_frames = tuple(poster_frames)
self.save() self.save()
for i in self.poster_frames: for i in self.poster_frames:
from document.models import Document from document.models import Document
qs = Document.objects.filter(id=ox.fromAZ(i['document'])) if 'document' in i:
if qs.count() > 0: qs = Document.objects.filter(id=ox.fromAZ(i['document']))
frame = qs[0].thumbnail(size=1024, page=i.get('page')) if qs.count() > 0:
frames.append(frame) frame = qs[0].thumbnail(size=1024, page=i.get('page'))
frames.append(frame)
self.icon.name = self.path('icon.jpg') self.icon.name = self.path('icon.jpg')
icon = self.icon.path icon = self.icon.path
if frames: if frames:

View file

@ -46,7 +46,15 @@ pandora.ui.folders = function(section) {
pandora.$ui.personalListsMenu = Ox.MenuButton({ pandora.$ui.personalListsMenu = Ox.MenuButton({
items: [ items: [
{ id: 'newlist', title: Ox._('New {0}', [Ox._(folderItem)]), keyboard: 'control n' }, { id: 'newlist', title: Ox._('New {0}', [Ox._(folderItem)]), keyboard: 'control n' },
{ id: 'newlistfromselection', title: Ox._('New {0} from Selection', [Ox._(folderItem)]), keyboard: 'shift control n', disabled: ui.listSelection.length == 0 }, {
id: 'newlistfromselection',
title: Ox._('New {0} from Selection',
[Ox._(folderItem)]),
keyboard: 'shift control n',
disabled: ui.section == 'documents'
? ui.collectionSelection == 0
: ui.listSelection.length == 0
},
{ id: 'newsmartlist', title: Ox._('New Smart {0}', [Ox._(folderItem)]), keyboard: 'alt control n' }, { id: 'newsmartlist', title: Ox._('New Smart {0}', [Ox._(folderItem)]), keyboard: 'alt control n' },
{ id: 'newsmartlistfromresults', title: Ox._('New Smart {0} from Results', [Ox._(folderItem)]), keyboard: 'shift alt control n' }, { id: 'newsmartlistfromresults', title: Ox._('New Smart {0} from Results', [Ox._(folderItem)]), keyboard: 'shift alt control n' },
{}, {},

View file

@ -192,7 +192,9 @@ pandora.addFolderItem = function(section) {
}, function(result) { }, function(result) {
var posterFrames = result var posterFrames = result
? result.data.items.map(function(item) { ? result.data.items.map(function(item) {
return {item: item.id, position: item.posterFrame}; return section == 'documents'
? {document: item.id}
: {item: item.id, position: item.posterFrame};
}) : []; }) : [];
posterFrames = posterFrames.length == 1 posterFrames = posterFrames.length == 1
? Ox.repeat([posterFrames[0]], 4) ? Ox.repeat([posterFrames[0]], 4)