Show More
@@ -120,7 +120,8 b' class Attachment(models.Model):' | |||
|
120 | 120 | if file_viewer is None: |
|
121 | 121 | file_viewer = AbstractViewer |
|
122 | 122 | |
|
123 |
return file_viewer(self.file, self.mimetype, self.hash, self.url |
|
|
123 | return file_viewer(self.file, self.mimetype, self.hash, self.url, | |
|
124 | self.alias).get_view() | |
|
124 | 125 | |
|
125 | 126 | def __str__(self): |
|
126 | 127 | return self.url or self.file.url |
@@ -56,7 +56,7 b" CSS_CLASS_THUMB = 'thumb'" | |||
|
56 | 56 | |
|
57 | 57 | ABSTRACT_VIEW = '<div class="image">'\ |
|
58 | 58 | '{}'\ |
|
59 | '<div class="image-metadata"><a href="{}" download >{}, {}</a>'\ | |
|
59 | '<div class="image-metadata">{}<a href="{}" download >{}, {}</a>'\ | |
|
60 | 60 | ' <a class="file-menu" href="#" data-type="{}" data-search-url="{}" data-filename="{}">🔍 </a></div>'\ |
|
61 | 61 | '</div>' |
|
62 | 62 | URL_VIEW = '<div class="image">' \ |
@@ -100,12 +100,13 b' def file_exists(filename):' | |||
|
100 | 100 | |
|
101 | 101 | |
|
102 | 102 | class AbstractViewer: |
|
103 | def __init__(self, file, file_type, hash, url): | |
|
103 | def __init__(self, file, file_type, hash, url, alias): | |
|
104 | 104 | self.file = file |
|
105 | 105 | self.file_type = file_type |
|
106 | 106 | self.hash = hash |
|
107 | 107 | self.url = url |
|
108 | 108 | self.extension = get_extension(self.file.name) |
|
109 | self.alias = alias | |
|
109 | 110 | |
|
110 | 111 | @staticmethod |
|
111 | 112 | def supports(file_type): |
@@ -120,7 +121,9 b' class AbstractViewer:' | |||
|
120 | 121 | else: |
|
121 | 122 | search_url = '' |
|
122 | 123 | |
|
123 | return ABSTRACT_VIEW.format(self.get_format_view(), self.file.url, | |
|
124 | alias = self.alias + '<br />' if self.alias else '' | |
|
125 | ||
|
126 | return ABSTRACT_VIEW.format(self.get_format_view(), alias, self.file.url, | |
|
124 | 127 | self.file_type, filesizeformat(self.file.size), |
|
125 | 128 | self.file_type, search_url, self.file.name) |
|
126 | 129 |
General Comments 0
You need to be logged in to leave comments.
Login now