feat(v2): streamline saved searches and favorites flows

This commit is contained in:
Alfredo Di Stasio
2026-03-13 14:40:38 +01:00
parent 0ed4fc57b8
commit 20d3ee7dae
6 changed files with 198 additions and 4 deletions

View File

@ -1,3 +1,4 @@
<div id="saved-search-table">
{% if saved_searches %}
<div class="table-wrap mt-4">
<table class="data-table">
@ -21,7 +22,14 @@
<div class="flex flex-wrap gap-2">
<a class="btn-secondary" href="{% url 'scouting:saved_search_run' saved_search.pk %}">Run</a>
<a class="btn-secondary" href="{% url 'scouting:saved_search_edit' saved_search.pk %}">Edit</a>
<form method="post" action="{% url 'scouting:saved_search_delete' saved_search.pk %}">
<form
method="post"
action="{% url 'scouting:saved_search_delete' saved_search.pk %}"
hx-post="{% url 'scouting:saved_search_delete' saved_search.pk %}"
hx-target="#saved-search-table"
hx-swap="outerHTML"
hx-indicator="#htmx-loading"
>
{% csrf_token %}
<button class="btn-secondary" type="submit">Delete</button>
</form>
@ -35,3 +43,4 @@
{% else %}
<div class="empty-state mt-4">No saved searches yet.</div>
{% endif %}
</div>

View File

@ -7,7 +7,23 @@
<h1>Edit Saved Search</h1>
<form method="post" class="mt-4 space-y-4">
{% csrf_token %}
{{ form.as_p }}
<div>
<label for="{{ form.name.id_for_label }}">{{ form.name.label }}</label>
{{ form.name }}
{% for error in form.name.errors %}<p class="text-sm text-rose-700">{{ error }}</p>{% endfor %}
</div>
<div class="flex items-center gap-2">
{{ form.is_public }}
<label for="{{ form.is_public.id_for_label }}">{{ form.is_public.label }}</label>
{% for error in form.is_public.errors %}<p class="text-sm text-rose-700">{{ error }}</p>{% endfor %}
</div>
<div>
<label for="{{ form.filters_json.id_for_label }}">{{ form.filters_json.label }}</label>
{{ form.filters_json }}
<p class="mt-1 text-xs text-slate-500">{{ form.filters_json.help_text }}</p>
{% for error in form.filters_json.errors %}<p class="text-sm text-rose-700">{{ error }}</p>{% endfor %}
</div>
{% for error in form.non_field_errors %}<p class="text-sm text-rose-700">{{ error }}</p>{% endfor %}
<div class="flex flex-wrap gap-2">
<button type="submit" class="btn">Update</button>
<a class="btn-secondary" href="{% url 'scouting:index' %}">Cancel</a>