2020-11-16 15:26:03 +00:00
|
|
|
{% import "net/http" %}
|
|
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
|
|
|
|
|
|
{% func HistoryHTML(rq *http.Request, hyphaName, tbody string) %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<main>
|
2020-11-16 15:26:03 +00:00
|
|
|
{%= navHTML(rq, hyphaName, "history") %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Time</th>
|
|
|
|
<th>Hash</th>
|
|
|
|
<th>Message</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{%s= tbody %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</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) %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<main>
|
2020-11-16 15:26:03 +00:00
|
|
|
{%= 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-16 15:26:03 +00:00
|
|
|
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, tree string) %}
|
2020-10-02 15:31:59 +00:00
|
|
|
<main>
|
2020-11-16 15:26:03 +00:00
|
|
|
{%= 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>
|
|
|
|
<hr/>
|
2020-11-16 15:26:03 +00:00
|
|
|
{% if u := user.FromRequest(rq).OrAnon(); 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 new binary part</label>
|
|
|
|
<br>
|
|
|
|
<input type="file" id="upload-binary__input" name="binary"/>
|
|
|
|
<input type="submit"/>
|
|
|
|
</form>
|
|
|
|
<hr/>
|
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 %}
|