Show More
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -13,6 +13,12 b' FILE_TYPES_AUDIO = (' | |||
|
13 | 13 | 'mp3', |
|
14 | 14 | ) |
|
15 | 15 | |
|
16 | PLAIN_FILE_FORMATS = { | |
|
17 | 'pdf': 'pdf', | |
|
18 | 'djvu': 'djvu', | |
|
19 | 'txt': 'txt', | |
|
20 | } | |
|
21 | ||
|
16 | 22 | |
|
17 | 23 | def get_viewers(): |
|
18 | 24 | return AbstractViewer.__subclasses__() |
@@ -35,9 +41,15 b' class AbstractViewer:' | |||
|
35 | 41 | self.file_type, filesizeformat(self.file.size)) |
|
36 | 42 | |
|
37 | 43 | def get_format_view(self): |
|
44 | if self.file_type in PLAIN_FILE_FORMATS: | |
|
45 | image = 'images/fileformats/{}.png'.format( | |
|
46 | PLAIN_FILE_FORMATS[self.file_type]) | |
|
47 | else: | |
|
48 | image = FILE_STUB_IMAGE | |
|
49 | ||
|
38 | 50 | return '<a href="{}">'\ |
|
39 | 51 | '<img src="{}" width="200" height="150"/>'\ |
|
40 |
'</a>'.format(self.file.url, static( |
|
|
52 | '</a>'.format(self.file.url, static(image)) | |
|
41 | 53 | |
|
42 | 54 | |
|
43 | 55 | class VideoViewer(AbstractViewer): |
General Comments 0
You need to be logged in to leave comments.
Login now