Skip to content

Commit 2ce9f0f

Browse files
Wizard polish: plain-language collection question, module search filter
The mode question now reads "How do you want to collect and publish maps created through this portal?" with four direct answers (publish automatically / prompt on completion / must complete a form / admin gallery only). The module list gains a type-to-filter box — there are too many modules to scan — that never hides a checked module, so filtering can't silently drop a selection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 5316e93 commit 2ce9f0f

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

cms/content/portal_wizard.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,14 @@
5454
# Wizard-facing framing of FormConfig.collection_mode: "are maps collected,
5555
# and if so how?" Values are the COLLECTION_MODE_CHOICES values verbatim.
5656
MAP_COLLECTION_CHOICES = [
57+
("auto_public", "Automatically collect and publish maps."),
5758
(
5859
"prompt",
59-
"Yes — mapmakers are asked to submit their map with a short entry "
60-
"form when they mark it ready to share. Submitted snapshots are "
61-
"frozen.",
62-
),
63-
(
64-
"auto_public",
65-
"Yes, automatically — every map drawn from the portal appears in the "
66-
"public gallery as soon as it is in progress or ready to share. No "
67-
"form.",
68-
),
69-
(
70-
"internal",
71-
"Yes, but privately — maps are collected automatically and shown "
72-
"only in the admin gallery, never publicly.",
73-
),
74-
(
75-
"form",
76-
"No — visitors submit written testimony through a form on the page "
77-
"(with an optional map link). Maps are not collected automatically.",
60+
"Users should be prompted to submit their map on completion, with an "
61+
"optional short form.",
7862
),
63+
("form", "Users must complete a form on the portal."),
64+
("internal", "Do not publish maps. Only collect an admin gallery I can see."),
7965
]
8066
# Modes where mapmaking is the point: the portal must offer map modules.
8167
MAP_COLLECTING_MODES = {"prompt", "auto_public", "internal"}
@@ -144,7 +130,8 @@ class PortalWizardForm(forms.Form):
144130
choices=MAP_COLLECTION_CHOICES,
145131
initial="prompt",
146132
widget=forms.RadioSelect,
147-
label="Are maps collected from this portal? If so, how?",
133+
label="How do you want to collect and publish maps created through "
134+
"this portal?",
148135
)
149136
map_modules = forms.MultipleChoiceField(
150137
widget=forms.CheckboxSelectMultiple,

cms/content/templates/content/portal_wizard.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
<legend><h2>Maps</h2></legend>
3030
<ul class="fields">
3131
<li>{% include "wagtailadmin/shared/field.html" with field=form.collection_mode %}</li>
32+
<li>
33+
<label for="module-search">Find a map module</label>
34+
<input type="search" id="module-search" placeholder="Type to filter the modules below…" autocomplete="off" style="max-width: 24rem;">
35+
</li>
3236
<li>{% include "wagtailadmin/shared/field.html" with field=form.map_modules %}</li>
3337
</ul>
3438
</fieldset>
@@ -100,6 +104,19 @@ <h3>Custom questions</h3>
100104
total.value = index + 1;
101105
});
102106

107+
// Module filter: hide non-matching checkboxes as you type.
108+
// Checked modules stay visible (and stay submitted regardless),
109+
// so a filter can never silently drop a selection.
110+
const moduleBoxes = Array.from(document.querySelectorAll('input[name="map_modules"]'))
111+
.map(input => ({row: input.closest('li') || input.parentElement, input}));
112+
document.getElementById('module-search').addEventListener('input', (event) => {
113+
const query = event.target.value.trim().toLowerCase();
114+
moduleBoxes.forEach(({row, input}) => {
115+
row.hidden = Boolean(query) && !input.checked
116+
&& !row.textContent.toLowerCase().includes(query);
117+
});
118+
});
119+
103120
// Pagination: one step at a time, all steps at once on an error
104121
// re-render (the server validates the whole form in one POST).
105122
const paginate = {{ paginate|yesno:"true,false" }};

0 commit comments

Comments
 (0)