mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-13 05:50:27 +00:00
126 lines
3.3 KiB
Plaintext
126 lines
3.3 KiB
Plaintext
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
|
|
|
{% func BaseHTML(title, body string, u *user.User, 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 main-width">
|
|
<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 -%}
|
|
{%s= userMenuHTML(u) %}
|
|
</ul>
|
|
</nav>
|
|
</header>
|
|
{%s= body %}
|
|
</body>
|
|
</html>
|
|
{% endfunc %}
|
|
|
|
{% func UserListHTML() %}
|
|
<div class="layout">
|
|
<main class="main-width user-list">
|
|
<h1>List of users</h1>
|
|
{% code
|
|
var (
|
|
admins = make([]string, 0)
|
|
moderators = make([]string, 0)
|
|
editors = make([]string, 0)
|
|
)
|
|
for u := range user.YieldUsers() {
|
|
switch u.Group {
|
|
case "admin":
|
|
admins = append(admins, u.Name)
|
|
case "moderator":
|
|
moderators = append(moderators, u.Name)
|
|
case "editor", "trusted":
|
|
editors = append(editors, u.Name)
|
|
}
|
|
}
|
|
%}
|
|
<section>
|
|
<h2>Admins</h2>
|
|
<ol>{% for _, name := range admins %}
|
|
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
|
|
{% endfor %}</ol>
|
|
</section>
|
|
<section>
|
|
<h2>Moderators</h2>
|
|
<ol>{% for _, name := range moderators %}
|
|
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
|
|
{% endfor %}</ol>
|
|
</section>
|
|
<section>
|
|
<h2>Editors</h2>
|
|
<ol>{% for _, name := range editors %}
|
|
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
|
|
{% endfor %}</ol>
|
|
</section>
|
|
</main>
|
|
</div>
|
|
{% endfunc %}
|
|
|
|
{% func HyphaListHTML(tbody string, pageCount int) %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<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>
|
|
</div>
|
|
{% 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() %}
|
|
<div class="layout">
|
|
<main class="main-width">
|
|
<section>
|
|
<h1>About {%s util.SiteName %}</h1>
|
|
<ul>
|
|
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.13 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>
|
|
</div>
|
|
{% endfunc %}
|