2021-02-20 16:14:33 +00:00
|
|
|
{% import "net/http" %}
|
|
|
|
{% import "strings" %}
|
2022-02-19 09:54:20 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
2021-12-20 21:08:21 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" %}
|
2021-09-06 17:46:34 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
2021-02-20 16:14:33 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
2021-08-08 19:19:55 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
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) %}
|
2021-08-08 19:19:55 +00:00
|
|
|
{% 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>
|
2021-08-08 19:19:55 +00:00
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
{% endfunc %}
|
2021-02-20 16:14:33 +00:00
|
|
|
|
2022-02-19 08:26:38 +00:00
|
|
|
{% func hyphaInfo(rq *http.Request, h hyphae.Hypha) %}
|
2021-08-08 19:19:55 +00:00
|
|
|
{% code
|
2021-02-20 16:14:33 +00:00
|
|
|
u := user.FromRequest(rq)
|
2021-09-06 17:46:34 +00:00
|
|
|
lc := l18n.FromRequest(rq)
|
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">
|
2021-09-06 17:46:34 +00:00
|
|
|
{%= hyphaInfoEntry(h, u, "history", lc.Get("ui.history_link")) %}
|
2022-02-19 16:42:32 +00:00
|
|
|
{%= hyphaInfoEntry(h, u, "rename", lc.Get("ui.rename_link")) %}
|
2022-02-26 06:42:54 +00:00
|
|
|
{%= 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)) %}
|
2021-08-08 19:19:55 +00:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2021-02-20 16:14:33 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2021-09-06 17:46:34 +00:00
|
|
|
{% func siblingHyphaeHTML(siblings string, lc *l18n.Localizer) %}
|
2022-02-19 09:54:20 +00:00
|
|
|
{% if cfg.UseSiblingHyphaeSidebar %}
|
2021-07-12 15:23:25 +00:00
|
|
|
<aside class="sibling-hyphae layout-card">
|
2021-09-06 17:46:34 +00:00
|
|
|
<h2 class="sibling-hyphae__title layout-card__title">{%s lc.Get("ui.sibling_hyphae") %}</h2>
|
2021-07-12 15:23:25 +00:00
|
|
|
{%s= siblings %}
|
2021-02-20 16:14:33 +00:00
|
|
|
</aside>
|
2022-02-19 09:54:20 +00:00
|
|
|
{% endif %}
|
2021-02-20 16:14:33 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2021-09-06 17:46:34 +00:00
|
|
|
{% func SubhyphaeHTML(subhyphae string, lc *l18n.Localizer) %}
|
2021-02-20 16:14:33 +00:00
|
|
|
{% if strings.TrimSpace(subhyphae) != "" %}
|
|
|
|
<section class="subhyphae">
|
2021-09-06 17:46:34 +00:00
|
|
|
<h2 class="subhyphae__title">{%s lc.Get("ui.subhyphae") %}</h2>
|
2021-02-20 16:14:33 +00:00
|
|
|
<nav class="subhyphae__nav">
|
|
|
|
<ul class="subhyphae__list">
|
|
|
|
{%s= subhyphae %}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
{% endfunc %}
|