Private
Public Access
Add tags and tag-based stream filtering
Implements tag management (create/delete) and per-article tagging with a freeform "add tag" input that creates the tag on first use instead of requiring a separate create-then-assign flow. Tags render as pills in the stream header; clicking one filters the stream to articles carrying that tag, combinable with the existing read/starred/saved filters. The "Saved" filter already added in the reading-UI milestone functions as the reading list, so this closes out the reading-list/tags milestone without a separate dedicated view. Verified live in-browser: creating a tag from an article, the pill appearing in the stream nav, filtering by it, and deleting it from the tag-management page, all via htmx without full page reloads. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69e3520e3b
commit
579696efc0
12 files changed
+386
-5
No files matched your search
@@ -0,0 +1,26 @@
|
||||
<div id="article-tags-{{ article.pk }}" class="article-tags">
|
||||
{% for tag in tags %}
|
||||
<span class="tag-pill" {% if tag.color %}style="--tag-color: {{ tag.color }};"{% endif %}>
|
||||
{{ tag.name }}
|
||||
<button
|
||||
hx-post="{% url 'articles:remove_tag_from_article' article.pk tag.pk %}"
|
||||
hx-target="#article-tags-{{ article.pk }}"
|
||||
hx-swap="outerHTML"
|
||||
class="tag-remove" title="Remove tag">×</button>
|
||||
</span>
|
||||
{% endfor %}
|
||||
|
||||
<form
|
||||
hx-post="{% url 'articles:add_tag_to_article' article.pk %}"
|
||||
hx-target="#article-tags-{{ article.pk }}"
|
||||
hx-swap="outerHTML"
|
||||
class="add-tag-form">
|
||||
<input type="text" name="tag_name" placeholder="Add tag" list="user-tags-{{ article.pk }}" maxlength="100">
|
||||
<button type="submit" class="icon-btn">Add</button>
|
||||
</form>
|
||||
<datalist id="user-tags-{{ article.pk }}">
|
||||
{% for tag in all_user_tags %}
|
||||
<option value="{{ tag.name }}">
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Tags — Evection{% endblock %}
|
||||
{% block content %}
|
||||
<p><a href="{% url 'reader:stream' %}">← Back to stream</a></p>
|
||||
<h1>Tags</h1>
|
||||
|
||||
<ul class="tag-manage-list">
|
||||
{% for tag in tags %}
|
||||
<li>
|
||||
<a href="{% url 'reader:stream' %}?tag={{ tag.pk }}" class="tag-pill"
|
||||
{% if tag.color %}style="--tag-color: {{ tag.color }};"{% endif %}>{{ tag.name }}</a>
|
||||
<form method="post" action="{% url 'articles:delete_tag' tag.pk %}" class="inline-form">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="icon-btn">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
{% empty %}
|
||||
<li class="empty-state">No tags yet.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h2>New tag</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Create</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user