Allow unsharing, only show share controls for owner

This commit is contained in:
Maximilian Friedersdorff 2025-10-09 21:04:45 +01:00
parent a54abeaea2
commit 4fb4bec5a8
3 changed files with 60 additions and 15 deletions

View file

@ -7,15 +7,23 @@
<a class="btn btn-primary" href="{{.urlEdit}}">Edit</a>
<a class="btn btn-danger" href="{{.urlDelete}}">Delete</a>
</div>
{{ if .isOwner }}
<div class="mt-2">
<h3>Ownership</h3>
{{if .note.Viewers}}
<p>This note is owned by <em>{{.note.Owner}}</em> and is further visible to</p>
<ul>
<form action="{{.urlUnshare}}" method="POST">
<table class="table vertical-align-middle">
{{range .viewers}}
<li>{{.}}</li>
<tr>
<td>{{.}}</td>
<td class="text-end">
<button class="btn btn-outline-warning btn-sm" type="submit" name="viewer" value="{{.}}">Un-Share</button>
</td>
</tr>
{{end}}
</ul>
</table>
</form>
{{else}}
<p>This note is owned by <em>{{.note.Owner}}</em>.</p>
{{end}}
@ -27,6 +35,7 @@
</div>
<button class="btn btn-primary" type="submit">Share</button>
</div>
{{end}}
<script>
let checkBoxes = document.querySelectorAll('input[type=checkbox]')