mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 19:56:16 +00:00
ee8bc742a8
It doesn't really work yet though. You can only look at it
130 lines
4.1 KiB
HTML
130 lines
4.1 KiB
HTML
{{define "interwiki map"}}Interwiki map{{end}}
|
|
{{define "title"}}{{template "interwiki map"}}{{end}}
|
|
|
|
{{define "static map"}}
|
|
{{if len .Entries}}
|
|
<ul>
|
|
{{range $i, $wiki := .Entries}}
|
|
<li>
|
|
<dl>
|
|
<dt>Name</dt>
|
|
<dd>{{.Name}}</dd>
|
|
|
|
<dt>Aliases</dt>
|
|
{{range .Aliases}}<dd>{{.}}</dd>{{end}}
|
|
|
|
<dt>Engine</dt>
|
|
<dd>{{.Engine}}</dd>
|
|
|
|
<dt>URL</dt>
|
|
<dd><a href="{{.URL}}">{{.URL}}</a></dd>
|
|
|
|
<dt>Link href format</dt>
|
|
<dd>{{.LinkHrefFormat}}</dd>
|
|
|
|
<dt>Img src format</dt>
|
|
<dd>{{.ImgSrcFormat}}</dd>
|
|
</dl>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p>No interwiki map set.</p>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{define "authorized map"}}
|
|
{{if .Error}}
|
|
<p class="error">{{.Error}}</p>
|
|
{{end}}
|
|
{{if len .Entries}}
|
|
{{range $i, $wiki := .Entries}}
|
|
<form method="post" action="/interwiki/modify-entry/{{.Name}}">
|
|
<p>
|
|
<label for="name{{$i}}" class="required-field">Name:</label>
|
|
<input type="text" id="name" name="name{{$i}}" required
|
|
value="{{.Name}}">
|
|
</p>
|
|
<p>
|
|
<label for="aliases{{$i}}">Aliases (separated by commas):</label>
|
|
<input type="text" id="aliases{{$i}}" name="aliases"
|
|
value="{{range $j, $alias := .Aliases}}{{if gt $j 0}}, {{end}}{{.}}{{end}}">
|
|
</p>
|
|
<p>
|
|
<label for="url{{$i}}" class="required-field">URL:</label>
|
|
<input type="url" id="url{{$i}}" name="url" required
|
|
value="{{.URL}}">
|
|
</p>
|
|
<p>
|
|
<label for="engine{{$i}}" class="required-field">Engine:</label>
|
|
<select name="engine" id="engine{{$i}}" required>
|
|
<option value="mycorrhiza" {{if eq .Engine "mycorrhiza"}}selected{{end}}>Mycorrhiza 🍄</option>
|
|
<option value="agora" {{if eq .Engine "agora"}}selected{{end}}>Agora ἀ</option>
|
|
<option value="generic" {{if eq .Engine "generic"}}selected{{end}}>Generic (any website)</option>
|
|
</select>
|
|
</p>
|
|
<p>
|
|
<label for="link-href-format{{$i}}">Link href attribute format string:</label>
|
|
<input type="url" id="link-href-format{{$i}}" name="link-href-format"
|
|
value="{{.LinkHrefFormat}}">
|
|
</p>
|
|
<p>
|
|
<label for="img-src-format{{$i}}">Image src attribute format string:</label>
|
|
<input type="url" id="img-src-format{{$i}}" name="img-src-format"
|
|
value="{{.ImgSrcFormat}}">
|
|
</p>
|
|
<input type="submit" class="btn" value="Save">
|
|
</form>
|
|
{{end}}
|
|
{{end}}
|
|
<form method="post" action="/interwiki/add-entry">
|
|
<h2>Add interwiki entry</h2>
|
|
<p>
|
|
<label for="name" class="required-field">Name:</label>
|
|
<input type="text" id="name" name="name" required
|
|
placeholder="home_wiki">
|
|
</p>
|
|
<p>
|
|
<label for="aliases">Aliases (separated by commas):</label>
|
|
<input type="text" id="aliases" name="aliases"
|
|
placeholder="homewiki, hw">
|
|
</p>
|
|
<p>
|
|
<label for="url" class="required-field">URL:</label>
|
|
<input type="url" id="url" name="url" required
|
|
placeholder="https://wiki.example.org">
|
|
</p>
|
|
<p>
|
|
<label for="engine" class="required-field">Engine:</label>
|
|
<select name="engine" id="engine" required>
|
|
<option value="mycorrhiza">Mycorrhiza 🍄</option>
|
|
<option value="agora">Agora ἀ</option>
|
|
<option value="generic">Generic (any website)</option>
|
|
</select>
|
|
</p>
|
|
<p>
|
|
<label for="link-href-format">Link href attribute format string:</label>
|
|
<input type="url" id="link-href-format" name="link-href-format"
|
|
placeholder="https://wiki.example.org/view/{NAME}">
|
|
</p>
|
|
<p>
|
|
<label for="img-src-format">Image src attribute format string:</label>
|
|
<input type="url" id="img-src-format" name="img-src-format"
|
|
placeholder="https://wiki.example.org/media/{NAME}">
|
|
</p>
|
|
<input type="submit" class="btn">
|
|
</form>
|
|
{{end}}
|
|
|
|
{{define "body"}}
|
|
<main class="main-width">
|
|
<h1>{{template "interwiki map"}}</h1>
|
|
{{if .CanEdit}}
|
|
<p><a href="/help/en/interwiki">Documentation.</a> Edit and save every entry separately.</p>
|
|
{{template "authorized map" .}}
|
|
{{else}}
|
|
<p><a href="/help/en/interwiki">Documentation.</a></p>
|
|
{{template "static map" .}}
|
|
{{end}}
|
|
</main>
|
|
{{end}} |