document icon, fixes #2987

This commit is contained in:
j 2017-01-25 17:41:06 +01:00
parent aeab4d03de
commit 0db8ca6c47
8 changed files with 8 additions and 6 deletions

1
.gitignore vendored
View file

@ -21,6 +21,7 @@ scripts/list_icon.py
scripts/item_icon.py
static/png/icon.png
static/png/logo.png
static/png/document.png
._*
static/django_extensions
*.pyc

View file

@ -279,7 +279,7 @@ def update_static():
f = os.path.join(root, f)
os.system('gzip -9 -c "%s" > "%s.gz"' % (f, f))
for name in ('logo', 'icon'):
for name in ('logo', 'icon', 'document'):
site = os.path.join(settings.STATIC_ROOT, 'png/%s.%s.png'%(name, settings.CONFIG['site']['id']))
pandora = os.path.join(settings.STATIC_ROOT, 'png/%s.pandora.png'%name)
image = os.path.join(settings.STATIC_ROOT, 'png/%s.png'%name)

View file

@ -46,7 +46,7 @@ class Document(models.Model):
extension = models.CharField(max_length=255)
size = models.IntegerField(default=0)
matches = models.IntegerField(default=0)
ratio = models.FloatField(default=640/1024)
ratio = models.FloatField(default=-1)
pages = models.IntegerField(default=-1)
width = models.IntegerField(default=-1)
height = models.IntegerField(default=-1)
@ -458,6 +458,8 @@ class Document(models.Model):
if 'description' in keys and d[0].description:
response['description'] = d[0].description
response['index'] = d[0].index
if response.get('ratio') == -1:
response['ratio'] = settings.CONFIG['posters']['ratio']
if keys:
for key in list(response):
if key not in keys:
@ -489,8 +491,7 @@ class Document(models.Model):
def thumbnail(self, size=None, page=None):
if not self.file:
return os.path.join(settings.STATIC_ROOT, 'png/cover.png')
return os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg')
return os.path.join(settings.STATIC_ROOT, 'png/document.png')
src = self.file.path
folder = os.path.dirname(src)
if size:
@ -563,7 +564,7 @@ class Document(models.Model):
if self.width > 0:
size = self.resolution
else:
size = [640, 1024]
size = [-1, 1]
self.ratio = size[0] / size[1]
return self.ratio

View file

@ -8,7 +8,7 @@ pandora.ui.documentBrowser = function() {
var that = Ox.IconList({
borderRadius: 0,
centered: true,
defaultRatio: 640/1024,
defaultRatio: pandora.site.posters.ratio,
draggable: true,
id: 'list',
item: function(data, sort, size) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB