2021-02-20 16:14:33 +00:00
|
|
|
{% import "net/http" %}
|
|
|
|
{% import "strings" %}
|
|
|
|
{% 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
|
|
|
|
2021-08-08 19:19:55 +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 %}">
|
|
|
|
<a class="hypha-info__link" href="/{%s action %}/{%s h.Name %}">{%s displayText %}</a>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
{% endfunc %}
|
2021-02-20 16:14:33 +00:00
|
|
|
|
2021-08-08 19:19:55 +00:00
|
|
|
{% func hyphaInfo(rq *http.Request, h *hyphae.Hypha) %}
|
|
|
|
{% code
|
2021-02-20 16:14:33 +00:00
|
|
|
u := user.FromRequest(rq)
|
|
|
|
%}
|
2021-08-08 19:19:55 +00:00
|
|
|
<nav class="hypha-info">
|
|
|
|
<ul class="hypha-info__list">
|
2021-08-11 09:20:29 +00:00
|
|
|
{%= hyphaInfoEntry(h, u, "history", "View history") %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "rename-ask", "Rename") %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "delete-ask", "Delete") %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "text", "View markup") %}
|
|
|
|
{%= hyphaInfoEntry(h, u, "attachment", "Manage attachment") %}
|
2021-08-08 19:19:55 +00:00
|
|
|
</ul>
|
|
|
|
</nav>
|
2021-02-20 16:14:33 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
2021-07-12 15:23:25 +00:00
|
|
|
{% func siblingHyphaeHTML(siblings string) %}
|
|
|
|
<aside class="sibling-hyphae layout-card">
|
|
|
|
<h2 class="sibling-hyphae__title layout-card__title">Sibling hyphae</h2>
|
|
|
|
{%s= siblings %}
|
2021-02-20 16:14:33 +00:00
|
|
|
</aside>
|
|
|
|
{% endfunc %}
|
|
|
|
|
|
|
|
{% func SubhyphaeHTML(subhyphae string) %}
|
|
|
|
{% if strings.TrimSpace(subhyphae) != "" %}
|
|
|
|
<section class="subhyphae">
|
|
|
|
<h2 class="subhyphae__title">Subhyphae</h2>
|
|
|
|
<nav class="subhyphae__nav">
|
|
|
|
<ul class="subhyphae__list">
|
|
|
|
{%s= subhyphae %}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
{% endfunc %}
|