mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
52 lines
1.7 KiB
Plaintext
52 lines
1.7 KiB
Plaintext
{% import "net/http" %}
|
|
{% import "strings" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
|
|
|
{% 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 %}">
|
|
<a class="hypha-info__link" href="/{%s action %}/{%s h.Name %}">{%s displayText %}</a>
|
|
</li>
|
|
{% endif %}
|
|
{% endfunc %}
|
|
|
|
{% func hyphaInfo(rq *http.Request, h *hyphae.Hypha) %}
|
|
{% code
|
|
u := user.FromRequest(rq)
|
|
lc := l18n.FromRequest(rq)
|
|
backs := hyphae.BacklinksCount(h)
|
|
%}
|
|
<nav class="hypha-info">
|
|
<ul class="hypha-info__list">
|
|
{%= hyphaInfoEntry(h, u, "history", lc.Get("ui.history_link")) %}
|
|
{%= hyphaInfoEntry(h, u, "rename-ask", lc.Get("ui.rename_link")) %}
|
|
{%= hyphaInfoEntry(h, u, "delete-ask", lc.Get("ui.delete_link")) %}
|
|
{%= hyphaInfoEntry(h, u, "text", lc.Get("ui.text_link")) %}
|
|
{%= hyphaInfoEntry(h, u, "attachment", lc.Get("ui.attachment_link")) %}
|
|
{%= hyphaInfoEntry(h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) %}
|
|
</ul>
|
|
</nav>
|
|
{% endfunc %}
|
|
|
|
{% func siblingHyphaeHTML(siblings string, lc *l18n.Localizer) %}
|
|
<aside class="sibling-hyphae layout-card">
|
|
<h2 class="sibling-hyphae__title layout-card__title">{%s lc.Get("ui.sibling_hyphae") %}</h2>
|
|
{%s= siblings %}
|
|
</aside>
|
|
{% endfunc %}
|
|
|
|
{% func SubhyphaeHTML(subhyphae string, lc *l18n.Localizer) %}
|
|
{% if strings.TrimSpace(subhyphae) != "" %}
|
|
<section class="subhyphae">
|
|
<h2 class="subhyphae__title">{%s lc.Get("ui.subhyphae") %}</h2>
|
|
<nav class="subhyphae__nav">
|
|
<ul class="subhyphae__list">
|
|
{%s= subhyphae %}
|
|
</ul>
|
|
</nav>
|
|
</section>
|
|
{% endif %}
|
|
{% endfunc %}
|