##// END OF EJS Templates
Show file metadata for all attachments
neko259 -
r1300:cc50b489 default
parent child Browse files
Show More
@@ -25,12 +25,16 b' class AbstractViewer:'
25 return True
25 return True
26
26
27 def get_view(self):
27 def get_view(self):
28 return '<div class="image"><a href="{}">'\
28 return '<div class="image">'\
29 '{}'\
30 '<div class="image-metadata">{}, {}</div>'\
31 '</div>'.format(self.get_format_view(),
32 self.file_type, filesizeformat(self.file.size))
33
34 def get_format_view(self):
35 return '<a href="{}">'\
29 '<img src="{}" width="200" height="150"/>'\
36 '<img src="{}" width="200" height="150"/>'\
30 '</a>'\
37 '</a>'.format(self.file.url,static(FILE_STUB_IMAGE))
31 '<div class="image-metadata">{}, {}</div>'\
32 '</div>'.format(self.file.url, static(FILE_STUB_IMAGE),
33 self.file_type, filesizeformat(self.file.size))
34
38
35
39
36 class WebmViewer(AbstractViewer):
40 class WebmViewer(AbstractViewer):
@@ -38,10 +42,9 b' class WebmViewer(AbstractViewer):'
38 def supports(file_type):
42 def supports(file_type):
39 return file_type == FILE_TYPE_WEBM
43 return file_type == FILE_TYPE_WEBM
40
44
41 def get_view(self):
45 def get_format_view(self):
42 return '<div class="image">'\
46 return '<video width="200" height="150" controls src="{}"></video>'\
43 '<video width="200" height="150" controls src="{}"/>'\
47 .format(self.file.url)
44 '</div>'.format(self.file.url)
45
48
46
49
47 class AudioViewer(AbstractViewer):
50 class AudioViewer(AbstractViewer):
@@ -49,10 +52,8 b' class AudioViewer(AbstractViewer):'
49 def supports(file_type):
52 def supports(file_type):
50 return file_type in FILE_TYPES_AUDIO
53 return file_type in FILE_TYPES_AUDIO
51
54
52 def get_view(self):
55 def get_format_view(self):
53 return '<div class="image">' \
56 return '<audio controls src="{}"></audio>'.format(self.file.url)
54 '<audio controls src="{}"/>' \
55 '</div>'.format(self.file.url)
56
57
57
58
58 class SvgViewer(AbstractViewer):
59 class SvgViewer(AbstractViewer):
@@ -60,9 +61,7 b' class SvgViewer(AbstractViewer):'
60 def supports(file_type):
61 def supports(file_type):
61 return file_type == FILE_TYPE_SVG
62 return file_type == FILE_TYPE_SVG
62
63
63 def get_view(self):
64 def get_format_view(self):
64 return '<div class="image">'\
65 return '<a class="thumb" href="{}">'\
65 '<a class="thumb" href="{}">'\
66 '<img class="post-image-preview" width="200" height="150" src="{}"/>'\
66 '<img class="post-image-preview" width="200" height="150" src="{}" />'\
67 '</a>'\
67 '</a>'.format(self.file.url, self.file.url)
68 '</div>'.format(self.file.url, self.file.url)
General Comments 0
You need to be logged in to leave comments. Login now