Add a "needs review" flag with a sidebar filter
Links can be bookmarked for a later look via a toggle button on the card (🏷️/🔖), shown with a yellow border while flagged. A new sidebar section "Merkliste" links to /?review=1, filtering to just the flagged links; the count updates live via the existing facets query. Since the project has no migration framework, add a minimal startup check that ALTER TABLEs in the needs_review column for existing SQLite databases (create_all only creates missing tables). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div class="panel link-card" id="link-{{ link.id }}">
|
||||
<div class="panel link-card {% if link.needs_review %}needs-review{% endif %}" id="link-{{ link.id }}">
|
||||
<div class="card-head">
|
||||
<span class="card-avatar" style="--h: {{ link.url | hue }};">
|
||||
{{ (link.url | domain)[:1] | upper or '?' }}
|
||||
@@ -14,6 +14,12 @@
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="ghost review-toggle {% if link.needs_review %}active{% endif %}"
|
||||
style="padding:3px 7px; font-size:.8rem;"
|
||||
title="{% if link.needs_review %}Nicht mehr zur Durchsicht{% else %}Zur Durchsicht markieren{% endif %}"
|
||||
hx-post="/links/{{ link.id }}/toggle-review"
|
||||
hx-target="#link-{{ link.id }}"
|
||||
hx-swap="outerHTML">{% if link.needs_review %}🔖{% else %}🏷️{% endif %}</button>
|
||||
<button class="ghost" style="padding:3px 7px; font-size:.8rem;"
|
||||
title="Bearbeiten"
|
||||
hx-get="/links/{{ link.id }}/edit"
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
#links > #empty-state { grid-column: 1 / -1; }
|
||||
|
||||
.link-card { display: flex; flex-direction: column; }
|
||||
.link-card.needs-review { border-color: #ca8a04; }
|
||||
.review-toggle.active { color: #fbbf24; border-color: #ca8a04; }
|
||||
.card-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
|
||||
.card-avatar {
|
||||
flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="layout">
|
||||
<aside class="sidebar">
|
||||
<div class="panel">
|
||||
<a href="/?sort={{ sort }}" class="facet {% if not active_category and not active_manufacturer %}active{% endif %}">
|
||||
<a href="/?sort={{ sort }}" class="facet {% if not active_category and not active_manufacturer and not review_only %}active{% endif %}">
|
||||
<span>📚 Alle Links</span>
|
||||
</a>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<h3>Kategorien</h3>
|
||||
{% for name, count in facets.categories %}
|
||||
<a href="/?category={{ name | urlencode }}&sort={{ sort }}"
|
||||
class="facet {% if active_category == name %}active{% endif %}">
|
||||
class="facet {% if active_category == name and not review_only %}active{% endif %}">
|
||||
<span>{{ name }}</span><span class="count">{{ count }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
@@ -39,13 +39,20 @@
|
||||
<h3>Hersteller / Quellen</h3>
|
||||
{% for name, count in facets.manufacturers %}
|
||||
<a href="/?manufacturer={{ name | urlencode }}&sort={{ sort }}"
|
||||
class="facet {% if active_manufacturer == name %}active{% endif %}">
|
||||
class="facet {% if active_manufacturer == name and not review_only %}active{% endif %}">
|
||||
<span>{{ name }}</span><span class="count">{{ count }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="muted" style="font-size:.85rem; padding:4px 8px;">noch keine</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="facet-group">
|
||||
<h3>Merkliste</h3>
|
||||
<a href="/?review=1&sort={{ sort }}" class="facet {% if review_only %}active{% endif %}">
|
||||
<span>🔖 Zur Durchsicht</span><span class="count">{{ facets.review_count }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -71,6 +78,7 @@
|
||||
<form id="searchform" onsubmit="return false;" style="margin:0;">
|
||||
<input type="hidden" name="category" value="{{ active_category }}">
|
||||
<input type="hidden" name="manufacturer" value="{{ active_manufacturer }}">
|
||||
<input type="hidden" name="review" value="{{ '1' if review_only else '' }}">
|
||||
<input type="text" name="q" value="{{ q }}"
|
||||
placeholder="🔍 Suche in Titel, Zusammenfassung, Tags..."
|
||||
hx-get="/search" hx-target="#links" hx-swap="innerHTML"
|
||||
|
||||
Reference in New Issue
Block a user