From b29499d7991e112974c1307ee25146b63aa868af Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laverdure Date: Tue, 9 Jan 2024 15:29:27 -0500 Subject: [PATCH 1/4] Update field.html to enable the use of custom-controls on checkbox inputs when show_form_labels is False (#1) The current code prevents the display of checkboxes (single) as BS4 custom-controls if show_form_labels is False. This modification moves the control of the label display around the label block itself allowing the display of checkboxes as custom-control regardless of the value of show_form_labels. --- crispy_bootstrap4/templates/bootstrap4/field.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crispy_bootstrap4/templates/bootstrap4/field.html b/crispy_bootstrap4/templates/bootstrap4/field.html index 76591bf..ff24c43 100644 --- a/crispy_bootstrap4/templates/bootstrap4/field.html +++ b/crispy_bootstrap4/templates/bootstrap4/field.html @@ -26,8 +26,8 @@ {% endif %} {% if not field|is_checkboxselectmultiple and not field|is_radioselect %} - {% if field|is_checkbox and form_show_labels %} - {%if use_custom_control%} + {% if field|is_checkbox %} + {% if use_custom_control %} {% if field.errors %} {% crispy_field field 'class' 'custom-control-input is-invalid' %} {% else %} @@ -40,9 +40,11 @@ {% crispy_field field 'class' 'form-check-input' %} {% endif %} {% endif %} + {% if form_show_labels %} + {% endif %} {% include 'bootstrap4/layout/help_text_and_errors.html' %} {% elif field|is_file and use_custom_control %} {% include 'bootstrap4/layout/field_file.html' %} From 470353bb0519b7083a9ad2f4a36d730ad232d9e5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laverdure Date: Wed, 10 Jan 2024 09:39:21 -0500 Subject: [PATCH 2/4] Update test_inline_formset_checkbox.html --- .../test_layout/test_inline_formset_checkbox.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html b/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html index 0c851d2..9990e6a 100644 --- a/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html +++ b/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html @@ -22,7 +22,7 @@
-
@@ -30,7 +30,7 @@
-
@@ -40,7 +40,7 @@
-
@@ -48,7 +48,7 @@
-
From 50a84a226744fd336dc6eeb59f7e0dc1c86934f8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laverdure Date: Wed, 17 Jan 2024 11:26:54 -0500 Subject: [PATCH 3/4] Update test_inline_formset_checkbox.html Removes extraneous
tags from testing template --- .../test_inline_formset_checkbox.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html b/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html index 9990e6a..0f4f1c8 100644 --- a/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html +++ b/tests/results/bootstrap4/test_layout/test_inline_formset_checkbox.html @@ -21,36 +21,28 @@
-
- -
-
- -
-
- -
-
- -
From 025ccf32e4768d0821764930078dc8eb447c064b Mon Sep 17 00:00:00 2001 From: jplaverdure Date: Mon, 5 Feb 2024 10:37:18 -0500 Subject: [PATCH 4/4] Fixes display issue tied with absence of