Skip to content

Commit d4de95e

Browse files
authored
Rename tbx template pack to tbxforms (#92)
1 parent 6fae62f commit d4de95e

28 files changed

+36
-32
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1616

1717
## Unreleased
1818

19+
### Changed
20+
21+
- Renamed `tbx` template directory and crispy forms template pack to `tbxforms` [#92]
22+
1923
### Fixed
2024

2125
- Conditional fields not working properly when there are multiple elements inspecting the same driving field [#91]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ INSTALLED_APPS = [
6060
Now add the following settings to tell `django-crispy-forms` to use `tbxforms`:
6161

6262
```python
63-
CRISPY_ALLOWED_TEMPLATE_PACKS = ["tbx"]
64-
CRISPY_TEMPLATE_PACK = "tbx"
63+
CRISPY_ALLOWED_TEMPLATE_PACKS = ["tbxforms"]
64+
CRISPY_TEMPLATE_PACK = "tbxforms"
6565
```
6666

6767
### Install the NPM package

tbxforms/templates/tbx/inputs.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

tbxforms/templates/tbx/layout/help_text_and_errors.html

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% if form.form_html %}
22
{% if include_media %}{{ form.media }}{% endif %}
3-
{% include "tbx/errors.html" %}
3+
{% include "tbxforms/errors.html" %}
44
{{ form.form_html }}
55
{% else %}
6-
{% include "tbx/uni_form.html" %}
6+
{% include "tbxforms/uni_form.html" %}
77
{% endif %}

tbxforms/templates/tbx/field.html renamed to tbxforms/templates/tbxforms/field.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="tbxforms-form-group{% if field.errors %} tbxforms-form-group--error{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
1111

1212
{% if field|is_checkboxes %}
13-
{% include "tbx/layout/checkboxes.html" %}
13+
{% include "tbxforms/layout/checkboxes.html" %}
1414
{% endif %}
1515

1616
{% if field|is_radios %}
17-
{% include "tbx/layout/radios.html" %}
17+
{% include "tbxforms/layout/radios.html" %}
1818
{% endif %}
1919

2020
{% if field|is_multivalue %}
21-
{% include "tbx/layout/multifield.html" %}
21+
{% include "tbxforms/layout/multifield.html" %}
2222
{% endif %}
2323

2424
{% if not field|is_checkboxes and not field|is_radios and not field|is_multivalue %}
@@ -36,7 +36,7 @@
3636
{% endif %}
3737

3838
{% if field|is_checkbox and form_show_labels %}
39-
{% include "tbx/layout/help_text_and_errors.html" %}
39+
{% include "tbxforms/layout/help_text_and_errors.html" %}
4040
<div class="tbxforms-checkboxes{% if checkboxes_small %} tbxforms-checkboxes--small{% endif %}">
4141
<div class="tbxforms-checkboxes__item">
4242
{% crispy_tbx_field field %}
@@ -46,7 +46,7 @@
4646
</div>
4747
</div>
4848
{% else %}
49-
{% include "tbx/layout/help_text_and_errors.html" %}
49+
{% include "tbxforms/layout/help_text_and_errors.html" %}
5050
{% crispy_tbx_field field %}
5151
{% if max_characters or max_words %}
5252
<p id="{{ field.id_for_label }}-info" class="tbxforms-hint tbxforms-character-count__message" aria-live="polite">
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% for input in inputs %}
2+
{% include "tbxforms/layout/baseinput.html" %}
3+
{% endfor %}

tbxforms/templates/tbx/layout/checkboxes.html renamed to tbxforms/templates/tbxforms/layout/checkboxes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</legend>
2121
{% endif %}
2222

23-
{% include "tbx/layout/help_text_and_errors.html" %}
23+
{% include "tbxforms/layout/help_text_and_errors.html" %}
2424

2525
<div class="tbxforms-checkboxes{% if inline %}--inline{% endif %}{% if checkboxes_small %} tbxforms-checkboxes--small{% endif %}">
2626
{% for choice in field.field.choices %}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{% include "tbxforms/layout/help_text.html" %}
2+
{% include "tbxforms/layout/field_errors.html" %}

tbxforms/templates/tbx/layout/multifield.html renamed to tbxforms/templates/tbxforms/layout/multifield.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</legend>
2121
{% endif %}
2222

23-
{% include "tbx/layout/help_text_and_errors.html" %}
23+
{% include "tbxforms/layout/help_text_and_errors.html" %}
2424
{% crispy_tbx_field field %}
2525

2626
</fieldset>

tbxforms/templates/tbx/layout/radios.html renamed to tbxforms/templates/tbxforms/layout/radios.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</legend>
2121
{% endif %}
2222

23-
{% include "tbx/layout/help_text_and_errors.html" %}
23+
{% include "tbxforms/layout/help_text_and_errors.html" %}
2424

2525
<div class="tbxforms-radios{% if radios_inline %}--inline{% endif %}{% if radios_small %} tbxforms-radios--small{% endif %}">
2626
{% for choice in field.field.choices %}

tbxforms/templates/tbx/uni_form.html renamed to tbxforms/templates/tbxforms/uni_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if include_media %}{{ form.media }}{% endif %}
22

3-
{% include "tbx/errors.html" %}
3+
{% include "tbxforms/errors.html" %}
44

55
{% for field in form %}
66
{% include field_template %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% with formset.management_form as form %}
2-
{% include "tbx/uni_form.html" %}
2+
{% include "tbxforms/uni_form.html" %}
33
{% endwith %}
44

55
{% for form in formset %}
66
<div class="multiField">
7-
{% include "tbx/uni_form.html" %}
7+
{% include "tbxforms/uni_form.html" %}
88
</div>
99
{% endfor %}

tbxforms/templates/tbx/whole_uni_form.html renamed to tbxforms/templates/tbxforms/whole_uni_form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
{% csrf_token %}
77
{% endif %}
88

9-
{% include "tbx/display_form.html" %}
9+
{% include "tbxforms/display_form.html" %}
1010

11-
{% include "tbx/inputs.html" %}
11+
{% include "tbxforms/inputs.html" %}
1212

1313
{% if form_tag %}
1414
</form>

tbxforms/templates/tbx/whole_uni_formset.html renamed to tbxforms/templates/tbxforms/whole_uni_formset.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
</div>
1414

1515
{% for form in formset %}
16-
{% include "tbx/display_form.html" %}
16+
{% include "tbxforms/display_form.html" %}
1717
{% endfor %}
1818

1919
{% if inputs %}
2020
<div class="form-actions">
2121
{% for input in inputs %}
22-
{% include "tbx/layout/baseinput.html" %}
22+
{% include "tbxforms/layout/baseinput.html" %}
2323
{% endfor %}
2424
</div>
2525
{% endif %}

tbxforms/templatetags/tbxforms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def render(self, context): # noqa: C901
172172
[getattr(field.field.widget, "widget", field.field.widget)],
173173
)
174174

175-
if template_pack == "tbx":
175+
if template_pack == "tbxforms":
176176
if is_multivalue(field):
177177
error_widgets = [field.widget for field in field.field.fields]
178178
error_count = sum(
@@ -215,7 +215,7 @@ def render(self, context): # noqa: C901
215215

216216
css_class = " ".join(css_class)
217217

218-
if template_pack == "tbx":
218+
if template_pack == "tbxforms":
219219
# The ability to override input_type was added to
220220
# avoid having to create new widgets. However, as a
221221
# result, the browser validates the field and displays
@@ -342,7 +342,7 @@ def crispy_tbx_field(parser, token):
342342
``django-crispy-forms``. Any additions are clearly marked with a
343343
check to see if the 'gds' template pack is being used.
344344
345-
This template tag is only used within the tbx/field.html template
345+
This template tag is only used within the tbxforms/field.html template
346346
and you almost certainly will not have to deal with it, even if
347347
you are laying out a form explicitly.
348348

tbxforms/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class DateInputWidget(forms.MultiWidget):
1818
1919
"""
2020

21-
template_name = "tbx/widgets/date.html"
21+
template_name = "tbxforms/widgets/date.html"
2222

2323
def __init__(self, *args, **kwargs):
2424
widgets = [

tests/layout/test_buttons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
),
1818
)
1919
class TestButtons:
20-
TEMPLATE = '{% include "tbx/layout/button.html" %}'
20+
TEMPLATE = '{% include "tbxforms/layout/button.html" %}'
2121

2222
def test_button(self, button_factory, snapshot_html):
2323
button = button_factory("name", "Title")

tests/layout/test_escaping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TestButtonEscaping:
4646
be marked as safe.
4747
"""
4848

49-
TEMPLATE = '{% include "tbx/layout/button.html" %}'
49+
TEMPLATE = '{% include "tbxforms/layout/button.html" %}'
5050

5151
def test_unsafe_markup_escaped(self, button_factory, snapshot_html):
5252
"""

tests/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
},
1919
]
2020

21-
CRISPY_ALLOWED_TEMPLATE_PACKS = ("tbx",)
21+
CRISPY_ALLOWED_TEMPLATE_PACKS = ("tbxforms",)
2222

23-
CRISPY_TEMPLATE_PACK = "tbx"
23+
CRISPY_TEMPLATE_PACK = "tbxforms"
2424

2525
CRISPY_FAIL_SILENTLY = False

0 commit comments

Comments
 (0)