Allow authors to hide editor notes

This commit is contained in:
Ben Visness 2022-09-12 22:55:51 -05:00
parent 045a2c2379
commit c9ee420dbb
1 changed files with 22 additions and 0 deletions

View File

@ -1,11 +1,21 @@
{{ template "base.html" . }}
{{ define "extrahead" }}
<style>
.hide-notes .note {
display: none;
}
</style>
{{ end }}
{{ define "content" }}
<h1>{{ .Title }}</h1>
{{ if and .User .User.IsEduAuthor }}
<div class="mb3">
<a href="{{ .EditUrl }}" title="Edit">&#9998; Edit</a>
<a href="{{ .DeleteUrl }}" title="Delete">&#10006; Delete</a>
<input id="hide-notes" type="checkbox">
<label for="hide-notes">Hide notes</label>
</div>
{{ end }}
<div class="flex">
@ -16,4 +26,16 @@
I'm a sidebar!
</div>
</div>
<script>
function toggleNotes() {
document.querySelector('.edu-article').classList.toggle('hide-notes',
document.querySelector('#hide-notes').checked,
);
}
document.querySelector('#hide-notes').addEventListener('change', event => {
toggleNotes();
});
toggleNotes();
</script>
{{ end }}