1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/templates/http_stuff.qtpl
2021-01-24 00:00:58 +05:00

78 lines
2.1 KiB
Plaintext

{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% func BaseHTML(title, body string, headElements ...string) %}
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/static/common.css">
<title>{%s title %}</title>
{% for _, el := range headElements %}{%s= el %}{% endfor %}
</head>
<body>
<header>
<nav class="header-links">
<ul class="header-links__list">
{%- for _, link := range util.HeaderLinks -%}
<li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li>
{%- endfor -%}
</ul>
</nav>
</header>
{%s= body %}
</body>
</html>
{% endfunc %}
{% func HyphaListHTML(tbody string, pageCount int) %}
<main>
<h1>List of hyphae</h1>
<p>This wiki has {%d pageCount %} hyphae.</p>
<table>
<thead>
<tr>
<th>Full name</th>
<th>Binary part type</th>
</tr>
</thead>
<tbody>
{%s= tbody %}
</tbody>
</table>
</main>
{% endfunc %}
{% func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) %}
<tr>
<td><a href="/page/{%s hyphaName %}">{%s hyphaName %}</a></td>
{% if binaryPresent %}
<td>{%s binaryMime %}</td>
{% else %}
<td></td>
{% endif %}
</tr>
{% endfunc %}
{% func AboutHTML() %}
<main>
<section>
<h1>About {%s util.SiteName %}</h1>
<ul>
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.12 indev</li>
{%- if user.AuthUsed -%}
<li><b>User count:</b> {%d user.Count() %}</li>
<li><b>Home page:</b> <a href="/">{%s util.HomePage %}</a></li>
<li><b>Administrators:</b> {%- for i, username := range user.ListUsersWithGroup("admin") -%}
{%- if i > 0 -%}<span aria-hidden="true">, </span>
{%- endif -%}
<a href="/page/{%s util.UserHypha %}/{%s username %}">{%s username %}</a>{%- endfor -%}</li>
{%- else -%}
<li>This wiki does not use authorization</li>
{%- endif -%}
</ul>
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
</section>
</main>
{% endfunc %}