1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/templates/http_readers.qtpl

66 lines
1.9 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" %}
2020-11-29 17:06:45 +00:00
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
2020-10-02 15:31:59 +00:00
<main>
{%= navHTML(rq, hyphaName, "history") %}
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>
2020-08-31 17:52:26 +00:00
{% endfunc %}
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) %}
2020-10-02 15:31:59 +00:00
<main>
{%= navHTML(rq, hyphaName, "revision", revHash) %}
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>
<hr/>
<aside>
{%s= tree %}
</aside>
</main>
2020-08-31 17:52:26 +00:00
{% endfunc %}
If `contents` == "", a helpful message is shown instead.
2020-11-29 11:32:52 +00:00
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, prevHyphaName, nextHyphaName string) %}
2020-10-02 15:31:59 +00:00
<main>
{%= navHTML(rq, hyphaName, "page") %}
2020-10-02 15:31:59 +00:00
<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>
2020-11-29 11:32:52 +00:00
<section class="prevnext">
{% if prevHyphaName != "" %}
<a class="prevnext__el prevnext__prev" href="/page/{%s prevHyphaName %}">← {%s path.Base(prevHyphaName) %}</a>
{% endif %}
{% if nextHyphaName != "" %}
<a class="prevnext__el prevnext__next" href="/page/{%s nextHyphaName %}">{%s path.Base(nextHyphaName) %} →</a>
{% endif %}
</section>
<hr class="page-separator"/>
{% if u := user.FromRequest(rq).OrAnon(); !user.AuthUsed || u.Group > user.UserAnon %}
2020-10-02 15:31:59 +00:00
<form action="/upload-binary/{%s hyphaName %}"
method="post" enctype="multipart/form-data">
<label for="upload-binary__input">Upload a new attachment</label>
2020-10-02 15:31:59 +00:00
<br>
<input type="file" id="upload-binary__input" name="binary"/>
<input type="submit"/>
</form>
<hr/>
{% endif %}
2020-10-02 15:31:59 +00:00
<aside>
{%s= tree %}
</aside>
</main>
2020-08-31 17:52:26 +00:00
{% endfunc %}