1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00
mycorrhiza/mycoopts/view.qtpl

38 lines
1.4 KiB
Plaintext
Raw Normal View History

{% import "path/filepath" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
2021-09-06 17:46:34 +00:00
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
2022-06-10 15:45:27 +00:00
{% func mediaRaw(h *hyphae.MediaHypha) %}{%= Media(h, l18n.New("en", "en")) %}{% endfunc %}
2021-09-06 17:46:34 +00:00
2022-03-20 21:24:40 +00:00
{% func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) %}
2022-02-19 08:26:38 +00:00
{% switch filepath.Ext(h.MediaFilePath()) %}
{% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %}
<div class="binary-container binary-container_with-img">
2022-02-03 22:29:01 +00:00
<a href="/binary/{%s= h.CanonicalName() %}"><img src="/binary/{%s= h.CanonicalName() %}"/></a>
</div>
{% case ".ogg", ".webm", ".mp4" %}
<div class="binary-container binary-container_with-video">
<video controls>
2022-02-03 22:29:01 +00:00
<source src="/binary/{%s= h.CanonicalName() %}"/>
<p>{%s lc.Get("ui.media_novideo") %} <a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_novideo_link") %}</a></p>
</video>
</div>
{% case ".mp3" %}
<div class="binary-container binary-container_with-audio">
<audio controls>
2022-02-03 22:29:01 +00:00
<source src="/binary/{%s= h.CanonicalName() %}"/>
<p>{%s lc.Get("ui.media_noaudio") %} <a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_noaudio_link") %}</a></p>
</audio>
</div>
{% default %}
<div class="binary-container binary-container_with-nothing">
2022-02-03 22:29:01 +00:00
<p><a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_download") %}</a></p>
</div>
{% endswitch %}
{% endfunc %}