Skip to content

Commit 375397c

Browse files
authored
Removed nested htmx triggering submission export on search (#4597)
Fixes #4545. Removed the nested htmx that was triggering CSV exporting on query search or altering of draft/archive sliders.
1 parent d53aabb commit 375397c

1 file changed

Lines changed: 157 additions & 128 deletions

File tree

  • hypha/apply/funds/templates/submissions

hypha/apply/funds/templates/submissions/all.html

Lines changed: 157 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -38,140 +38,169 @@
3838
{% endadminbar %}
3939

4040

41-
<form
42-
class="flex gap-2 justify-between items-center mt-3 md:gap-4"
43-
hx-trigger="change"
44-
hx-get="./"
45-
hx-target="#main"
46-
hx-push-url="true"
47-
hx-swap="outerHTML transition:true"
48-
>
41+
<div class="flex gap-2 justify-between items-center mt-4 md:gap-4">
42+
<form
43+
class="flex gap-2 justify-between items-center w-full md:gap-4"
44+
hx-trigger="change"
45+
hx-get="./"
46+
hx-target="#main"
47+
hx-push-url="true"
48+
hx-swap="outerHTML transition:true"
49+
>
4950

50-
{% dropdown_menu title="Filters" heading="Filter submissions" %}
51-
<a
52-
href="{% url "apply:submissions:list" %}?query=is:open"
53-
hx-get="{% url "apply:submissions:list" %}?query=is:open"
54-
hx-push-url="true"
55-
hx-target="#main"
56-
hx-swap="outerHTML transition:true"
57-
class="flex {% if request.GET.query == "is:open" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
58-
{% if request.GET.query == "is:open" %}
59-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
60-
{% endif %}
61-
{% trans "Open submissions" %} {{ request.GET.lead }}
62-
</a>
63-
<a
64-
href="{% url "apply:submissions:list" %}?query=lead:@me"
65-
hx-get="{% url "apply:submissions:list" %}?query=lead:@me"
66-
hx-push-url="true"
67-
hx-target="#main"
68-
hx-swap="outerHTML transition:true"
69-
class="flex {% if request.GET.query == "lead:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
70-
{% if request.GET.query == "lead:@me" %}
71-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
72-
{% endif %}
73-
{% trans "Your assigned submissions (lead)" %} {{ request.GET.lead }}
74-
</a>
75-
<a
76-
href="{% url "apply:submissions:list" %}?query=flagged:@me"
77-
hx-get="{% url "apply:submissions:list" %}?query=flagged:@me"
78-
hx-push-url="true"
79-
hx-target="#main"
80-
hx-swap="outerHTML transition:true"
81-
class="flex {% if request.GET.query == "flagged:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
82-
{% if request.GET.query == "flagged:@me" %}
83-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
84-
{% endif %}
85-
{% trans "Your flagged submissions" %}
86-
</a>
87-
<a
88-
href="{% url "apply:submissions:list" %}?query=flagged:@staff"
89-
hx-get="{% url "apply:submissions:list" %}?query=flagged:@staff"
90-
hx-push-url="true"
91-
hx-target="#main"
92-
hx-swap="outerHTML transition:true"
93-
class="flex {% if request.GET.query == "flagged:@staff" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
94-
{% if request.GET.query == "flagged:@staff" %}
95-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
96-
{% endif %}
97-
{% trans "Staff flagged submissions" %}
98-
</a>
99-
<a
100-
href="{% url "apply:submissions:list" %}?query=reviewer:@me"
101-
hx-get="{% url "apply:submissions:list" %}?query=reviewer:@me"
102-
hx-push-url="true"
103-
hx-target="#main"
104-
hx-swap="outerHTML transition:true"
105-
class="flex {% if request.GET.query == "reviewer:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
106-
{% if request.GET.query == "reviewer:@me" %}
107-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
108-
{% endif %}
109-
{% trans "Awaiting your review" %}
110-
</a>
111-
<a
112-
href="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
113-
hx-get="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
114-
hx-push-url="true"
115-
hx-target="#main"
116-
hx-swap="outerHTML transition:true"
117-
class="flex {% if request.GET.query == "reviewed-by:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
118-
{% if request.GET.query == "reviewed-by:@me" %}
119-
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
51+
{% dropdown_menu title="Filters" heading="Filter submissions" %}
52+
<a
53+
href="{% url "apply:submissions:list" %}?query=is:open"
54+
hx-get="{% url "apply:submissions:list" %}?query=is:open"
55+
hx-push-url="true"
56+
hx-target="#main"
57+
hx-swap="outerHTML transition:true"
58+
class="flex {% if request.GET.query == "is:open" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
59+
{% if request.GET.query == "is:open" %}
60+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
61+
{% endif %}
62+
{% trans "Open submissions" %} {{ request.GET.lead }}
63+
</a>
64+
<a
65+
href="{% url "apply:submissions:list" %}?query=lead:@me"
66+
hx-get="{% url "apply:submissions:list" %}?query=lead:@me"
67+
hx-push-url="true"
68+
hx-target="#main"
69+
hx-swap="outerHTML transition:true"
70+
class="flex {% if request.GET.query == "lead:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
71+
{% if request.GET.query == "lead:@me" %}
72+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
73+
{% endif %}
74+
{% trans "Your assigned submissions (lead)" %} {{ request.GET.lead }}
75+
</a>
76+
<a
77+
href="{% url "apply:submissions:list" %}?query=flagged:@me"
78+
hx-get="{% url "apply:submissions:list" %}?query=flagged:@me"
79+
hx-push-url="true"
80+
hx-target="#main"
81+
hx-swap="outerHTML transition:true"
82+
class="flex {% if request.GET.query == "flagged:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
83+
{% if request.GET.query == "flagged:@me" %}
84+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
85+
{% endif %}
86+
{% trans "Your flagged submissions" %}
87+
</a>
88+
<a
89+
href="{% url "apply:submissions:list" %}?query=flagged:@staff"
90+
hx-get="{% url "apply:submissions:list" %}?query=flagged:@staff"
91+
hx-push-url="true"
92+
hx-target="#main"
93+
hx-swap="outerHTML transition:true"
94+
class="flex {% if request.GET.query == "flagged:@staff" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
95+
{% if request.GET.query == "flagged:@staff" %}
96+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
97+
{% endif %}
98+
{% trans "Staff flagged submissions" %}
99+
</a>
100+
<a
101+
href="{% url "apply:submissions:list" %}?query=reviewer:@me"
102+
hx-get="{% url "apply:submissions:list" %}?query=reviewer:@me"
103+
hx-push-url="true"
104+
hx-target="#main"
105+
hx-swap="outerHTML transition:true"
106+
class="flex {% if request.GET.query == "reviewer:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
107+
{% if request.GET.query == "reviewer:@me" %}
108+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
109+
{% endif %}
110+
{% trans "Awaiting your review" %}
111+
</a>
112+
<a
113+
href="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
114+
hx-get="{% url "apply:submissions:list" %}?query=reviewed-by:@me"
115+
hx-push-url="true"
116+
hx-target="#main"
117+
hx-swap="outerHTML transition:true"
118+
class="flex {% if request.GET.query == "reviewed-by:@me" %}ps-2 font-medium bg-gray-100{% else %}ps-8 font-normal{% endif %} pe-3 py-2 text-gray-800 border-b items-center hover:bg-gray-100 focus:bg-gray-100">
119+
{% if request.GET.query == "reviewed-by:@me" %}
120+
{% heroicon_mini "check" aria_hidden="true" size=16 class="stroke-2 me-1" %}
121+
{% endif %}
122+
{% trans "Reviewed by you" %}
123+
</a>
124+
{% enddropdown_menu %}
125+
126+
{% for key, value in request.GET.items %}
127+
{% if key != 'page' and key != 'drafts' and key != 'query' and key != 'archived' %}
128+
<input type="hidden" name="{{ key }}" value="{{ value }}">
120129
{% endif %}
121-
{% trans "Reviewed by you" %}
122-
</a>
123-
{% enddropdown_menu %}
130+
{% endfor %}
124131

125-
{% for key, value in request.GET.items %}
126-
{% if key != 'page' and key != 'drafts' and key != 'query' and key != 'archived' %}
127-
<input type="hidden" name="{{ key }}" value="{{ value }}">
128-
{% endif %}
129-
{% endfor %}
132+
<label class="inline-flex relative flex-auto items-center">
133+
<span class="flex absolute inset-y-0 items-center pointer-events-none start-0 ps-3">
134+
{% heroicon_mini "magnifying-glass" size=20 class="text-fg-muted" aria_hidden=true %}
135+
</span>
136+
<input
137+
type="text"
138+
id="search-navbar"
139+
class="w-full input"
140+
placeholder="{% trans 'Search…' %}"
141+
name="query"
142+
aria-label="{% trans 'Search submissions' %}"
143+
value="{{ search_query|default_if_none:'' }}" {% if search_query %}autofocus{% endif %}
144+
>
145+
</label>
130146

131-
<label class="inline-flex relative flex-auto items-center">
132-
<span class="flex absolute inset-y-0 items-center pointer-events-none start-0 ps-3">
133-
{% heroicon_mini "magnifying-glass" size=20 class="text-fg-muted" aria_hidden=true %}
134-
</span>
135-
<input
136-
type="text"
137-
id="search-navbar"
138-
class="block p-2 w-full text-sm text-gray-900 bg-gray-50 border border-gray-300 focus:border-blue-500 focus:ring-blue-500 rounded-xs ps-10"
139-
placeholder="{% trans 'Search…' %}"
140-
name="query"
141-
aria-label="{% trans 'Search submissions' %}"
142-
value="{{ search_query|default_if_none:'' }}" {% if search_query %}autofocus{% endif %}
143-
>
144-
</label>
145-
146-
{% if can_view_archive %}
147-
<span>
148-
<label class="inline-flex relative items-center cursor-pointer">
149-
<input type="checkbox" {% if show_archived %}checked{% endif %}
150-
class="sr-only peer"
151-
name="archived"
147+
{% if can_view_archive %}
148+
<label class="label">
149+
<input
150+
type="checkbox"
151+
name="archived"
152+
{% if show_archived %}checked{% endif %}
153+
class="toggle toggle-sm toggle-primary"
152154
>
153-
<div
154-
class="w-11 h-6 bg-gray-200 rounded-full dark:bg-gray-700 peer-focus:outline-hidden peer-focus:ring-4 peer-focus:ring-blue-300 peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[ dark:peer-focus:ring-blue-800''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600">
155-
</div>
156-
<span class="text-sm font-medium text-gray-600 ms-3">{% trans "Archived" %}</span>
155+
{% trans "Archived" %}
157156
</label>
158-
</span>
159-
{% endif %}
157+
{% endif %}
160158

161-
{% if can_access_drafts %}
162-
<span>
163-
<label class="inline-flex relative items-center cursor-pointer">
164-
<input type="checkbox" {% if show_drafts %}checked{% endif %}
165-
class="sr-only peer"
166-
name="drafts"
167-
>
168-
<div
169-
class="w-11 h-6 bg-gray-200 rounded-full dark:bg-gray-700 peer-focus:outline-hidden peer-focus:ring-4 peer-focus:ring-blue-300 peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[ dark:peer-focus:ring-blue-800''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600">
170-
</div>
171-
<span class="text-sm font-medium text-gray-600 ms-3">{% trans "Drafts" %}</span>
172-
</label>
173-
</span>
174-
{% endif %}
159+
<label class="inline-flex relative flex-auto items-center">
160+
<span class="flex absolute inset-y-0 items-center pointer-events-none start-0 ps-3">
161+
{% heroicon_mini "magnifying-glass" size=20 class="text-fg-muted" aria_hidden=true %}
162+
</span>
163+
<input
164+
type="text"
165+
id="search-navbar"
166+
class="block p-2 w-full text-sm text-gray-900 bg-gray-50 border border-gray-300 focus:border-blue-500 focus:ring-blue-500 rounded-xs ps-10"
167+
placeholder="{% trans 'Search…' %}"
168+
name="query"
169+
aria-label="{% trans 'Search submissions' %}"
170+
value="{{ search_query|default_if_none:'' }}" {% if search_query %}autofocus{% endif %}
171+
>
172+
</label>
173+
174+
{% if can_view_archive %}
175+
<span>
176+
<label class="inline-flex relative items-center cursor-pointer">
177+
<input type="checkbox" {% if show_archived %}checked{% endif %}
178+
class="sr-only peer"
179+
name="archived"
180+
>
181+
<div
182+
class="w-11 h-6 bg-gray-200 rounded-full dark:bg-gray-700 peer-focus:outline-hidden peer-focus:ring-4 peer-focus:ring-blue-300 peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[ dark:peer-focus:ring-blue-800''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600">
183+
</div>
184+
<span class="text-sm font-medium text-gray-600 ms-3">{% trans "Archived" %}</span>
185+
</label>
186+
</span>
187+
{% endif %}
188+
189+
{% if can_access_drafts %}
190+
<span>
191+
<label class="inline-flex relative items-center cursor-pointer">
192+
<input type="checkbox" {% if show_drafts %}checked{% endif %}
193+
class="sr-only peer"
194+
name="drafts"
195+
>
196+
<div
197+
class="w-11 h-6 bg-gray-200 rounded-full dark:bg-gray-700 peer-focus:outline-hidden peer-focus:ring-4 peer-focus:ring-blue-300 peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[ dark:peer-focus:ring-blue-800''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600">
198+
</div>
199+
<span class="text-sm font-medium text-gray-600 ms-3">{% trans "Drafts" %}</span>
200+
</label>
201+
</span>
202+
{% endif %}
203+
</form>
175204

176205
{% if can_export_submissions %}
177206
<button
@@ -185,7 +214,7 @@
185214
{% heroicon_mini "arrow-down-tray" %}
186215
</button>
187216
{% endif %}
188-
</form>
217+
</div>
189218

190219
{% if is_filtered %}
191220
{% comment %} Display option to clear all the filters {% endcomment %}

0 commit comments

Comments
 (0)