1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/views/nav.qtpl

38 lines
1.3 KiB
Plaintext
Raw Normal View History

{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
2022-04-02 16:58:57 +00:00
{% import "github.com/bouncepaw/mycorrhiza/backlinks" %}
2021-02-20 16:14:33 +00:00
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
2022-03-29 20:59:36 +00:00
{% import "github.com/bouncepaw/mycorrhiza/viewutil" %}
2021-02-20 16:14:33 +00:00
2022-02-19 08:26:38 +00:00
{% func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action, displayText string) %}
{% if u.CanProceed(action) %}
<li class="hypha-info__entry hypha-info__entry_{%s action %}">
2022-02-03 22:29:01 +00:00
<a class="hypha-info__link" href="/{%s action %}/{%s h.CanonicalName() %}">{%s displayText %}</a>
</li>
{% endif %}
{% endfunc %}
2021-02-20 16:14:33 +00:00
2022-03-29 20:59:36 +00:00
{% func hyphaInfo(meta viewutil.Meta, h hyphae.Hypha) %}
{% code
u := meta.U
lc := meta.Lc
backs := backlinks.BacklinksCount(h)
2021-02-20 16:14:33 +00:00
%}
<nav class="hypha-info">
<ul class="hypha-info__list">
2021-09-06 17:46:34 +00:00
{%= hyphaInfoEntry(h, u, "history", lc.Get("ui.history_link")) %}
{%= hyphaInfoEntry(h, u, "rename", lc.Get("ui.rename_link")) %}
{%= hyphaInfoEntry(h, u, "delete", lc.Get("ui.delete_link")) %}
2021-09-06 17:46:34 +00:00
{%= hyphaInfoEntry(h, u, "text", lc.Get("ui.text_link")) %}
2022-02-26 07:33:09 +00:00
{%= hyphaInfoEntry(h, u, "media", lc.Get("ui.media_link")) %}
2021-09-06 17:46:34 +00:00
{%= hyphaInfoEntry(h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) %}
</ul>
</nav>
2021-02-20 16:14:33 +00:00
{% endfunc %}
2022-04-09 11:55:55 +00:00
{% func commonScripts() %}
{% for _, scriptPath := range cfg.CommonScripts %}
<script src="{%s scriptPath %}"></script>
{% endfor %}
{% endfunc %}