2020-11-16 15:26:03 +00:00
|
|
|
{% import "net/http" %}
|
2020-11-29 11:32:52 +00:00
|
|
|
{% import "path" %}
|
2020-11-16 15:26:03 +00:00
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
|
|
|
2020-11-29 17:06:45 +00:00
|
|
|
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
|
2020-11-16 15:26:03 +00:00
|
|
|
{%= navHTML(rq, hyphaName, "history") %}
|
2021-01-20 13:53:30 +00:00
|
|
|
<main>
|
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 %}
|
|
|
|
|
2020-11-16 15:26:03 +00:00
|
|
|
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) %}
|
|
|
|
{%= navHTML(rq, hyphaName, "revision", revHash) %}
|
2021-01-20 13:53:30 +00:00
|
|
|
<main>
|
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.
|
2021-01-19 18:08:59 +00:00
|
|
|
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, prevHyphaName, nextHyphaName string, hasAmnt bool) %}
|
2020-11-16 15:26:03 +00:00
|
|
|
{%= navHTML(rq, hyphaName, "page") %}
|
2021-01-20 13:53:30 +00:00
|
|
|
<main>
|
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 != "" %}
|
2021-01-14 11:39:54 +00:00
|
|
|
<a class="prevnext__el prevnext__prev" href="/page/{%s prevHyphaName %}" rel="prev">← {%s path.Base(prevHyphaName) %}</a>
|
2020-11-29 11:32:52 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if nextHyphaName != "" %}
|
2021-01-14 11:39:54 +00:00
|
|
|
<a class="prevnext__el prevnext__next" href="/page/{%s nextHyphaName %}" rel="next">{%s path.Base(nextHyphaName) %} →</a>
|
2020-11-29 11:32:52 +00:00
|
|
|
{% endif %}
|
|
|
|
</section>
|
2021-01-09 20:49:48 +00:00
|
|
|
{% if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<form action="/upload-binary/{%s hyphaName %}"
|
2021-01-14 11:56:47 +00:00
|
|
|
method="post" enctype="multipart/form-data"
|
|
|
|
class="upload-amnt">
|
2021-01-19 18:08:59 +00:00
|
|
|
{% if hasAmnt %}
|
|
|
|
<a class="upload-amnt__unattach" href="/unattach-ask/{%s hyphaName %}">Unattach current attachment?</a>
|
|
|
|
{% endif %}
|
2020-11-18 13:27:18 +00:00
|
|
|
<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>
|
2020-11-16 15:26:03 +00:00
|
|
|
{% endif %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<aside>
|
|
|
|
{%s= tree %}
|
|
|
|
</aside>
|
|
|
|
</main>
|
2020-08-31 17:52:26 +00:00
|
|
|
{% endfunc %}
|