Files
pages/templates/pages/link_manager.gohtml
T

185 lines
2.7 KiB
Go Template

{{ define "link_manager.gohtml" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ T "link.title" }}</title>
<link rel="stylesheet" href="/o/path:/system/static/css/main.css">
<link rel="stylesheet" href="/o/path:/system/static/css/modes.css">
</head>
<body>
<header class="topbar">
<div class="brand">
<a href="/">{{ .WikiName }}</a>
</div>
<nav>
{{ range .NavItems }}
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
</header>
<main class="container">
<section>
<h1>{{ T "link.title" }}</h1>
<p class="muted">
{{ T "link.object" }}:
<code>{{ .ObjectURI }}</code>
</p>
<table class="link-table">
<thead>
<tr>
<th>{{ T "link.primary" }}</th>
<th>{{ T "link.path" }}</th>
<th>{{ T "link.linked_at" }}</th>
<th>{{ T "link.action" }}</th>
</tr>
</thead>
<tbody>
{{ range .Links }}
<tr>
<td>
<form method="post" action="/l/uuid:{{ $.ObjectUUID }}">
<input type="hidden" name="action" value="primary">
<input type="hidden" name="path" value="{{ .Path }}">
<input
type="radio"
name="primary_display"
{{ if .IsPrimary }}checked{{ end }}
onchange="this.form.submit()"
>
</form>
</td>
<td>
<a href="{{ .Path }}">
{{ .Path }}
</a>
</td>
<td class="mono">
{{ formatUnix .CreatedAt }}
</td>
<td>
<form
method="post"
action="/l/uuid:{{ $.ObjectUUID }}"
onsubmit="return confirm('Delete link?\n\n{{ .Path }}')"
>
<input type="hidden" name="action" value="delete">
<input type="hidden" name="path" value="{{ .Path }}">
<button type="submit">
Delete
</button>
</form>
</td>
</tr>
{{ end }}
</tbody>
</table>
<h2>{{ T "link.add_path" }}</h2>
<form
method="post"
action="/l/uuid:{{ .ObjectUUID }}"
class="add-link-form"
>
<input type="hidden" name="action" value="add">
<input
name="path"
type="text"
placeholder="{{ T "link.placeholder" }}"
>
<button type="submit">
Add
</button>
</form>
</section>
</main>
<style>
.link-table {
width: 100%;
border-collapse: collapse;
margin-top: 1rem;
}
.link-table th {
text-align: left;
font-weight: normal;
color: #888;
border-bottom: 1px solid rgba(255,255,255,0.08);
padding: 0.45rem 0.35rem;
}
.link-table td {
border-bottom: 1px solid rgba(255,255,255,0.035);
padding: 0.38rem 0.35rem;
}
.link-table tr:hover {
background: rgba(255,255,255,0.025);
}
.add-link-form {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
}
.add-link-form input[type="text"] {
flex: 1;
background: #0b0b0b;
color: #eee;
border: 1px solid #222;
padding: 0.6rem;
font-family: monospace;
}
.mono {
font-family:
"JetBrains Mono",
monospace;
}
.muted {
color: #777;
}
button {
cursor: pointer;
}
</style>
</body>
</html>
{{ end }}