1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-13 22:00:27 +00:00
mycorrhiza/templates/readers.qtpl

70 lines
2.3 KiB
Plaintext
Raw Normal View History

{% import "net/http" %}
2020-11-29 11:32:52 +00:00
{% import "path" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
2020-11-29 17:06:45 +00:00
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
{%= navHTML(rq, hyphaName, "history") %}
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-11-29 17:06:45 +00:00
<article class="history">
<h1>History of {%s hyphaName %}</h1>
{%s= list %}
</article>
2020-10-02 15:31:59 +00:00
</main>
2021-01-26 05:41:57 +00:00
</div>
2020-08-31 17:52:26 +00:00
{% endfunc %}
2021-01-26 05:41:57 +00:00
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, revHash string) %}
{%= navHTML(rq, hyphaName, "revision", revHash) %}
2021-01-26 05:41:57 +00:00
<div class="layout">
<main class="main-width">
2020-10-02 15:31:59 +00:00
<article>
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
{%s= naviTitle %}
{%s= contents %}
</article>
</main>
2021-01-26 05:41:57 +00:00
{%= relativeHyphae(relatives) %}
</div>
2020-08-31 17:52:26 +00:00
{% endfunc %}
If `contents` == "", a helpful message is shown instead.
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, prevHyphaName, nextHyphaName string, hasAmnt bool) %}
{%= navHTML(rq, hyphaName, "page") %}
2021-01-25 18:37:21 +00:00
<div class="layout">
2021-01-26 05:41:57 +00:00
<main class="main-width">
<article>
{%s= naviTitle %}
{% if contents == "" %}
<p>This hypha has no text. Why not <a href="/edit/{%s hyphaName %}">create it</a>?</p>
{% else %}
{%s= contents %}
{% endif %}
</article>
<section class="prevnext">
{% if prevHyphaName != "" %}
<a class="prevnext__el prevnext__prev" href="/hypha/{%s prevHyphaName %}" rel="prev">← {%s util.BeautifulName(path.Base(prevHyphaName)) %}</a>
2021-01-26 05:41:57 +00:00
{% endif %}
{% if nextHyphaName != "" %}
<a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a>
2021-01-26 05:41:57 +00:00
{% endif %}
</section>
{% if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" %}
<form action="/upload-binary/{%s hyphaName %}"
method="post" enctype="multipart/form-data"
class="upload-amnt">
{% if hasAmnt %}
<a class="upload-amnt__unattach" href="/unattach-ask/{%s hyphaName %}">Unattach current attachment?</a>
{% endif %}
<label for="upload-binary__input">Upload a new attachment</label>
<br>
<input type="file" id="upload-binary__input" name="binary"/>
<input type="submit"/>
</form>
{% endif %}
</main>
{%= relativeHyphae(relatives) %}
</div>
2020-08-31 17:52:26 +00:00
{% endfunc %}