File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ def entries():
25
25
# TODO: pagination
26
26
# TODO: read time
27
27
# TODO: mark as ...
28
- # TODO: enclosures
29
28
30
29
form = EntryFilter (request .args )
31
30
kwargs = dict (form .data )
Original file line number Diff line number Diff line change @@ -110,9 +110,18 @@ <h2 class="h5 mb-1" style="font-size: 1.125rem">
110
110
< button type ="submit " class ="btn btn-outline-secondary btn-sm " style ="width: 2rem ">
111
111
< i class ="bi bi-arrow-down "> </ i >
112
112
</ button >
113
-
114
113
</ div >
115
114
115
+ {% for enclosure in entry.enclosures[:1] -%}
116
+ {%- set links = additional_enclosure_links(enclosure, entry) | list -%}
117
+ {%- set _ = links.append(('', enclosure.href)) -%}
118
+ {%- set link = links[0][1] -%}
119
+ < a class ="btn text-secondary btn-sm " role ="button " target ="_blank "
120
+ title ="{{ enclosure.type }} " href ="{{ link }} ">
121
+ < i class ="bi bi-{{ macros.bs_file_icon(enclosure.type) }} "> </ i >
122
+ </ a >
123
+ {%- endfor %}
124
+
116
125
</ form >
117
126
118
127
</ div >
Original file line number Diff line number Diff line change 34
34
</ div >
35
35
</ fieldset >
36
36
{%- endmacro %}
37
+
38
+
39
+ {%- macro bs_file_icon(mimetype) -%}
40
+ {%- set type = (mimetype or '').partition('/')[0] -%}
41
+ {%- if type == 'audio' -%} file-earmark-music
42
+ {%- elif type == 'image' -%} file-earmark-image
43
+ {%- elif type == 'video' -%} file-earmark-play
44
+ {%- elif type == 'text' -%} file-earmark-text
45
+ {%- else -%} file-earmark
46
+ {%- endif -%}
47
+ {%- endmacro -%}
You can’t perform that action at this time.
0 commit comments