From 076eacbe4c7ebe13cefde111f4e02038aa1e1123 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Sat, 25 Jul 2026 22:18:24 -0400 Subject: [PATCH 1/3] Render lang/arch/platform as inline radios instead of ugly list boxes (#169) The Language, Arch and Platform fields on the crackme upload and edit forms are single-value fields but were rendered as ` - - - - - - - - - - - - - - + {% set radio_name = 'lang' %} + {% set radio_options = LANG_CHOICES %} + {% set radio_selected = '' %} + {% include 'partial/choice_radios.html' %}
@@ -75,15 +64,10 @@

Quick Rules

- + {% set radio_name = 'arch' %} + {% set radio_options = ARCH_CHOICES %} + {% set radio_selected = '' %} + {% include 'partial/choice_radios.html' %}
@@ -91,15 +75,10 @@

Quick Rules

- + {% set radio_name = 'platform' %} + {% set radio_options = PLATFORM_CHOICES %} + {% set radio_selected = '' %} + {% include 'partial/choice_radios.html' %}
diff --git a/templates/crackme/edit.html b/templates/crackme/edit.html index 226dc7f..1169d26 100644 --- a/templates/crackme/edit.html +++ b/templates/crackme/edit.html @@ -16,21 +16,10 @@

Edit crackme: {{ crackme.name }}

- + {% set radio_name = 'lang' %} + {% set radio_options = LANG_CHOICES %} + {% set radio_selected = crackme.lang %} + {% include 'partial/choice_radios.html' %}
@@ -38,15 +27,10 @@

Edit crackme: {{ crackme.name }}

- + {% set radio_name = 'arch' %} + {% set radio_options = ARCH_CHOICES %} + {% set radio_selected = crackme.arch %} + {% include 'partial/choice_radios.html' %}
@@ -54,15 +38,10 @@

Edit crackme: {{ crackme.name }}

- + {% set radio_name = 'platform' %} + {% set radio_options = PLATFORM_CHOICES %} + {% set radio_selected = crackme.platform %} + {% include 'partial/choice_radios.html' %}
diff --git a/templates/partial/choice_radios.html b/templates/partial/choice_radios.html new file mode 100644 index 0000000..2b9f9a1 --- /dev/null +++ b/templates/partial/choice_radios.html @@ -0,0 +1,14 @@ +{# Inline single-choice radio buttons, laid out to match the label checkboxes + (templates/partial/labels_checkboxes.html) instead of an ugly multi-line + select list box. + + Expects: + radio_name - form field name (e.g. 'lang') + radio_options - list of allowed string values + radio_selected - the currently selected value ('' when none) #} +{% for opt in radio_options %} + +{% endfor %} From cd2e590810d74ed62a18c23dbf9d29fb8f00b2d8 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Sat, 25 Jul 2026 22:25:51 -0400 Subject: [PATCH 2/3] Box the metadata choices, add difficulty radios, unify search (#169) Follow-up on the same forms: - Upload form: render Difficulty as radio buttons too, so all four classification fields (difficulty/lang/arch/platform) are consistent. - Wrap each choice group in a bordered ".choice-box" so the fields are clearly separated from one another. - Search form: replace the lang/arch/platform ` - - - - - - - + {% set choice_type = 'radio' %} + {% set choice_name = 'difficulty' %} + {% set choice_options = DIFFICULTY_CHOICES %} + {% set choice_selected = '' %} + {% include 'partial/choice_inputs.html' %}
@@ -53,10 +50,11 @@

Quick Rules

- {% set radio_name = 'lang' %} - {% set radio_options = LANG_CHOICES %} - {% set radio_selected = '' %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'lang' %} + {% set choice_options = LANG_CHOICES %} + {% set choice_selected = '' %} + {% include 'partial/choice_inputs.html' %}
@@ -64,10 +62,11 @@

Quick Rules

- {% set radio_name = 'arch' %} - {% set radio_options = ARCH_CHOICES %} - {% set radio_selected = '' %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'arch' %} + {% set choice_options = ARCH_CHOICES %} + {% set choice_selected = '' %} + {% include 'partial/choice_inputs.html' %}
@@ -75,10 +74,11 @@

Quick Rules

- {% set radio_name = 'platform' %} - {% set radio_options = PLATFORM_CHOICES %} - {% set radio_selected = '' %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'platform' %} + {% set choice_options = PLATFORM_CHOICES %} + {% set choice_selected = '' %} + {% include 'partial/choice_inputs.html' %}
diff --git a/templates/crackme/edit.html b/templates/crackme/edit.html index 1169d26..6974bc2 100644 --- a/templates/crackme/edit.html +++ b/templates/crackme/edit.html @@ -16,10 +16,11 @@

Edit crackme: {{ crackme.name }}

- {% set radio_name = 'lang' %} - {% set radio_options = LANG_CHOICES %} - {% set radio_selected = crackme.lang %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'lang' %} + {% set choice_options = LANG_CHOICES %} + {% set choice_selected = crackme.lang %} + {% include 'partial/choice_inputs.html' %}
@@ -27,10 +28,11 @@

Edit crackme: {{ crackme.name }}

- {% set radio_name = 'arch' %} - {% set radio_options = ARCH_CHOICES %} - {% set radio_selected = crackme.arch %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'arch' %} + {% set choice_options = ARCH_CHOICES %} + {% set choice_selected = crackme.arch %} + {% include 'partial/choice_inputs.html' %}
@@ -38,10 +40,11 @@

Edit crackme: {{ crackme.name }}

- {% set radio_name = 'platform' %} - {% set radio_options = PLATFORM_CHOICES %} - {% set radio_selected = crackme.platform %} - {% include 'partial/choice_radios.html' %} + {% set choice_type = 'radio' %} + {% set choice_name = 'platform' %} + {% set choice_options = PLATFORM_CHOICES %} + {% set choice_selected = crackme.platform %} + {% include 'partial/choice_inputs.html' %}
diff --git a/templates/partial/choice_inputs.html b/templates/partial/choice_inputs.html new file mode 100644 index 0000000..3123f18 --- /dev/null +++ b/templates/partial/choice_inputs.html @@ -0,0 +1,22 @@ +{# Inline radio/checkbox group, boxed and laid out like the label checkboxes + (templates/partial/labels_checkboxes.html) instead of an ugly multi-line + select list box. + + Expects: + choice_type - 'radio' (single-select) or 'checkbox' (multi-select) + choice_name - form field name (e.g. 'lang') + choice_options - list of options; each item is either a plain string + (value == label) or a (value, label) pair + choice_selected - radio: the selected value string ('' when none) + checkbox: a list of the selected values #} +
+{% for opt in choice_options %} + {% set val = opt if opt is string else opt[0] %} + {% set text = opt if opt is string else opt[1] %} + {% set is_checked = (val in choice_selected) if choice_type == 'checkbox' else (choice_selected == val) %} + +{% endfor %} +
diff --git a/templates/partial/choice_radios.html b/templates/partial/choice_radios.html deleted file mode 100644 index 2b9f9a1..0000000 --- a/templates/partial/choice_radios.html +++ /dev/null @@ -1,14 +0,0 @@ -{# Inline single-choice radio buttons, laid out to match the label checkboxes - (templates/partial/labels_checkboxes.html) instead of an ugly multi-line - select list box. - - Expects: - radio_name - form field name (e.g. 'lang') - radio_options - list of allowed string values - radio_selected - the currently selected value ('' when none) #} -{% for opt in radio_options %} - -{% endfor %} diff --git a/templates/search/search.html b/templates/search/search.html index 50b260f..7b6c979 100644 --- a/templates/search/search.html +++ b/templates/search/search.html @@ -114,21 +114,11 @@

Crackme search

- + {% set choice_type = 'checkbox' %} + {% set choice_name = 'lang' %} + {% set choice_options = LANG_CHOICES %} + {% set choice_selected = search_params.get('lang', []) %} + {% include 'partial/choice_inputs.html' %}
@@ -136,15 +126,11 @@

Crackme search

- + {% set choice_type = 'checkbox' %} + {% set choice_name = 'arch' %} + {% set choice_options = ARCH_CHOICES %} + {% set choice_selected = search_params.get('arch', []) %} + {% include 'partial/choice_inputs.html' %}
@@ -152,19 +138,11 @@

Crackme search

- + {% set choice_type = 'checkbox' %} + {% set choice_name = 'platform' %} + {% set choice_options = PLATFORM_CHOICES %} + {% set choice_selected = search_params.get('platform', []) %} + {% include 'partial/choice_inputs.html' %}
From eb82f0debc123dee5c94d8da4a9b8c3b188d9c80 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Sat, 25 Jul 2026 22:29:49 -0400 Subject: [PATCH 3/3] Box the labels region on the upload form too (#169) Wrap the label checkboxes in the same .choice-box as difficulty/lang/arch/ platform so every choice group on the upload form is visually separated. Co-Authored-By: Claude Opus 4.8 --- templates/crackme/create.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/crackme/create.html b/templates/crackme/create.html index 8be2a7a..9bfd1c3 100644 --- a/templates/crackme/create.html +++ b/templates/crackme/create.html @@ -92,9 +92,11 @@

Quick Rules

applies, the specific technique underneath — ticking a technique ticks its category automatically. Reviewers may adjust these later.

- {% set label_input_name = 'labels' %} - {% set checked_labels = [] %} - {% include 'partial/labels_checkboxes.html' %} +
+ {% set label_input_name = 'labels' %} + {% set checked_labels = [] %} + {% include 'partial/labels_checkboxes.html' %} +