forked from 0x2620/pandora
document icon, fixes #2987
This commit is contained in:
parent
aeab4d03de
commit
0db8ca6c47
8 changed files with 8 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,6 +21,7 @@ scripts/list_icon.py
|
||||||
scripts/item_icon.py
|
scripts/item_icon.py
|
||||||
static/png/icon.png
|
static/png/icon.png
|
||||||
static/png/logo.png
|
static/png/logo.png
|
||||||
|
static/png/document.png
|
||||||
._*
|
._*
|
||||||
static/django_extensions
|
static/django_extensions
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
|
@ -279,7 +279,7 @@ def update_static():
|
||||||
f = os.path.join(root, f)
|
f = os.path.join(root, f)
|
||||||
os.system('gzip -9 -c "%s" > "%s.gz"' % (f, 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']))
|
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)
|
pandora = os.path.join(settings.STATIC_ROOT, 'png/%s.pandora.png'%name)
|
||||||
image = os.path.join(settings.STATIC_ROOT, 'png/%s.png'%name)
|
image = os.path.join(settings.STATIC_ROOT, 'png/%s.png'%name)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Document(models.Model):
|
||||||
extension = models.CharField(max_length=255)
|
extension = models.CharField(max_length=255)
|
||||||
size = models.IntegerField(default=0)
|
size = models.IntegerField(default=0)
|
||||||
matches = 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)
|
pages = models.IntegerField(default=-1)
|
||||||
width = models.IntegerField(default=-1)
|
width = models.IntegerField(default=-1)
|
||||||
height = 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:
|
if 'description' in keys and d[0].description:
|
||||||
response['description'] = d[0].description
|
response['description'] = d[0].description
|
||||||
response['index'] = d[0].index
|
response['index'] = d[0].index
|
||||||
|
if response.get('ratio') == -1:
|
||||||
|
response['ratio'] = settings.CONFIG['posters']['ratio']
|
||||||
if keys:
|
if keys:
|
||||||
for key in list(response):
|
for key in list(response):
|
||||||
if key not in keys:
|
if key not in keys:
|
||||||
|
@ -489,8 +491,7 @@ class Document(models.Model):
|
||||||
|
|
||||||
def thumbnail(self, size=None, page=None):
|
def thumbnail(self, size=None, page=None):
|
||||||
if not self.file:
|
if not self.file:
|
||||||
return os.path.join(settings.STATIC_ROOT, 'png/cover.png')
|
return os.path.join(settings.STATIC_ROOT, 'png/document.png')
|
||||||
return os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg')
|
|
||||||
src = self.file.path
|
src = self.file.path
|
||||||
folder = os.path.dirname(src)
|
folder = os.path.dirname(src)
|
||||||
if size:
|
if size:
|
||||||
|
@ -563,7 +564,7 @@ class Document(models.Model):
|
||||||
if self.width > 0:
|
if self.width > 0:
|
||||||
size = self.resolution
|
size = self.resolution
|
||||||
else:
|
else:
|
||||||
size = [640, 1024]
|
size = [-1, 1]
|
||||||
self.ratio = size[0] / size[1]
|
self.ratio = size[0] / size[1]
|
||||||
return self.ratio
|
return self.ratio
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ pandora.ui.documentBrowser = function() {
|
||||||
var that = Ox.IconList({
|
var that = Ox.IconList({
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
centered: true,
|
centered: true,
|
||||||
defaultRatio: 640/1024,
|
defaultRatio: pandora.site.posters.ratio,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
id: 'list',
|
id: 'list',
|
||||||
item: function(data, sort, size) {
|
item: function(data, sort, size) {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.6 KiB |
BIN
static/png/document.0xdb.png
Normal file
BIN
static/png/document.0xdb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
static/png/document.indiancinema.png
Normal file
BIN
static/png/document.indiancinema.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
static/png/document.padma.png
Normal file
BIN
static/png/document.padma.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in a new issue