Add public feed, admin area, self-registration, visibility & hashtags
Some checks failed
Deploy to NAS / deploy (push) Failing after 26s
Some checks failed
Deploy to NAS / deploy (push) Failing after 26s
- Public feed (/) with infinite scroll via Intersection Observer - Self-registration (/register) - Admin area (/admin/entries, /admin/users) with user management - journal_entries: visibility (public/private) + hashtags fields - users: is_admin flag - DB schema updated (recreate DB to apply) - CI: run go test via docker run (golang:1.25-alpine) — fixes 'go not found' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
72
backend/internal/api/templates/public.html
Normal file
72
backend/internal/api/templates/public.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{{define "title"}}Journal — Öffentliche Einträge{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
<main class="container">
|
||||
<nav>
|
||||
<strong>Journal</strong>
|
||||
<a href="/login">Anmelden</a>
|
||||
</nav>
|
||||
|
||||
<div id="feed">
|
||||
{{template "feed_items" .}}
|
||||
</div>
|
||||
</main>
|
||||
{{end}}
|
||||
|
||||
{{define "feed_items"}}
|
||||
{{range .Entries}}
|
||||
<article class="entry-card">
|
||||
<header>
|
||||
<small>{{.EntryDate}} · {{.EntryTime}}</small>
|
||||
{{if .Title}}<strong> · {{.Title}}</strong>{{end}}
|
||||
</header>
|
||||
{{if .Description}}<p>{{.Description}}</p>{{end}}
|
||||
{{if .Images}}
|
||||
<div class="entry-images">
|
||||
{{range .Images}}
|
||||
<a href="/uploads/{{.Filename}}" target="_blank">
|
||||
<img src="/uploads/{{.Filename}}" alt="{{.OriginalName}}" class="thumb">
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Hashtags}}
|
||||
<footer class="hashtags">
|
||||
{{range .Hashtags}}<span class="tag">#{{.}}</span> {{end}}
|
||||
</footer>
|
||||
{{end}}
|
||||
</article>
|
||||
{{else}}
|
||||
<p><small>// Noch keine öffentlichen Einträge</small></p>
|
||||
{{end}}
|
||||
{{if .HasMore}}
|
||||
<div id="sentinel" data-offset="{{.Offset}}"></div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{define "scripts"}}
|
||||
<script>
|
||||
(function() {
|
||||
const sentinel = document.getElementById('sentinel');
|
||||
if (!sentinel) return;
|
||||
const obs = new IntersectionObserver(function(entries) {
|
||||
if (!entries[0].isIntersecting) return;
|
||||
obs.disconnect();
|
||||
const offset = sentinel.dataset.offset;
|
||||
fetch('/feed?offset=' + offset)
|
||||
.then(r => r.text())
|
||||
.then(html => {
|
||||
sentinel.remove();
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = html;
|
||||
document.getElementById('feed').append(...div.childNodes);
|
||||
const next = document.getElementById('sentinel');
|
||||
if (next) obs.observe(next);
|
||||
});
|
||||
});
|
||||
obs.observe(sentinel);
|
||||
})();
|
||||
</script>
|
||||
{{end}}
|
||||
|
||||
{{template "base" .}}
|
||||
Reference in New Issue
Block a user