2022-04-02 16:58:57 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/backlinks" %}
|
2022-06-10 15:45:27 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
2021-08-08 19:19:55 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
2022-06-10 15:45:27 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
2022-03-29 20:59:36 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/viewutil" %}
|
2021-02-20 16:14:33 +00:00
|
|
|
|
2022-07-01 17:38:44 +00:00
|
|
|
{% func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action string, hasToExist bool, displayText string) %}
|
|
|
|
{% code flag := true %}
|
|
|
|
{% switch h.(type) %}
|
|
|
|
{% case *hyphae.EmptyHypha %}
|
|
|
|
{% code flag = !hasToExist %}
|
|
|
|
{% endswitch %}
|
|
|
|
{% if u.CanProceed(action) && flag %}
|
2021-08-08 19:19:55 +00:00
|
|
|
<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>
|
2021-08-08 19:19:55 +00:00
|
|
|
</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) %}
|
2021-08-08 19:19:55 +00:00
|
|
|
{% code
|
2022-03-22 13:57:25 +00:00
|
|
|
u := meta.U
|
|
|
|
lc := meta.Lc
|
2021-12-20 21:08:21 +00:00
|
|
|
backs := backlinks.BacklinksCount(h)
|
2021-02-20 16:14:33 +00:00
|
|
|
%}
|
2021-08-08 19:19:55 +00:00
|
|
|
<nav class="hypha-info">
|
|
|
|
<ul class="hypha-info__list">
|
2022-07-01 17:38:44 +00:00
|
|
|
{%= hyphaInfoEntry(h, u, "history", false, lc.Get("ui.history_link")) %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "rename", true, lc.Get("ui.rename_link")) %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "delete", true, lc.Get("ui.delete_link")) %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "text", true, lc.Get("ui.text_link")) %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "media", true, lc.Get("ui.media_link")) %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "backlinks", false, lc.GetPlural("ui.backlinks_link", backs)) %}
|
2021-08-08 19:19:55 +00:00
|
|
|
</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 %}
|
2022-06-10 15:45:27 +00:00
|
|
|
|
|
|
|
{% func beautifulLink(hyphaName string) %}<a href="/hypha/{%s= hyphaName %}">{%s util.BeautifulName(hyphaName) %}</a>{% endfunc %}
|