Skip to content

Commit

Permalink
Refactor all field_as_li.html includes
Browse files Browse the repository at this point in the history
`field_as_li.html` merely wraps a <li> and includes `field.html`.

Remove `field_as_li.html` template

It is no longer used.

Historical mention in 1.0 release notes [^1] has
been left intact.

[^1]: docs/releases/1.0.rst

Relates to wagtail#9031
  • Loading branch information
Stormheg authored and lb- committed Jul 16, 2023
1 parent ecb2126 commit fd93cae
Show file tree
Hide file tree
Showing 34 changed files with 176 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Changelog
* Maintenance: Update uuid to v9 and Jest to v29, with `jest-environment-jsdom` and new snapshot format (LB (Ben) Johnston)
* Maintenance: Update test cases producing undesirable console output due to missing mocks, uncaught errors, warnings (LB (Ben) Johnston)
* Maintenance: Remove unused snippets _header_with_history.html template (Thibaud Colas)
* Maintenance: Remove `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)


5.0.2 (21.06.2023)
Expand Down
19 changes: 19 additions & 0 deletions docs/releases/5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ This feature was developed by Aman Pandey as part of the Google Summer of Code p
* Remove unused snippets _header_with_history.html template (Thibaud Colas)
* Migrate dialog instantiation to a new `w-dialog` Stimulus controller, including in the Userbar (Loveth Omokaro, LB (Ben) Johnston)
* Support dialog template cloning using a new `w-teleport` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
* Remove `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)

## Upgrade considerations

Expand Down Expand Up @@ -300,6 +301,24 @@ The undocumented shared include `wagtailadmin/shared/last_updated.html` is no lo
{% human_readable_date my_model.timestamp %}
```

### Shared include `field_as_li.html` is no longer available

The documented include `"wagtailadmin/shared/field_as_li.html"` has been removed, if being used it will need to be replaced with `"wagtailadmin/shared/field.html"` wrapped within `li` tags.

#### Before

```html+django
{% include "wagtailadmin/shared/field_as_li.html" %}
```

#### After

```html+django
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
```

### Tag (Tagit) field usage now relies on data attributes

The `AdminTagWidget` widget has now been migrated to a Stimulus controller, if using this widget in Python, no changes are needed to adopt the new approach.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Insert anchor' %}" class="button" /></li>
</ul>
Expand Down
4 changes: 3 additions & 1 deletion wagtail/admin/templates/wagtailadmin/chooser/email_link.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Insert link' %}" class="button" /></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Insert link' %}" class="button" /></li>
</ul>
Expand Down
4 changes: 3 additions & 1 deletion wagtail/admin/templates/wagtailadmin/chooser/phone_link.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Insert link' %}" class="button" /></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
{% if filter_form.visible_fields %}
<ul class="fields">
{% for field in filter_form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
</ul>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<ul class="fields">
{% for field in creation_form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
<li>
{% if create_action_clicked_label %}
Expand Down
4 changes: 3 additions & 1 deletion wagtail/admin/templates/wagtailadmin/generic/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<ul class="fields">
{% block visible_fields %}
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endif %}
{% endfor %}
<li>
Expand Down
24 changes: 18 additions & 6 deletions wagtail/admin/templates/wagtailadmin/pages/copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,32 @@
<input type="hidden" name="next" value="{{ next }}" />

<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=form.new_title %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.new_slug %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.new_parent_page %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.new_title %}
</li>
<li>
{% include "wagtailadmin/shared/field.html" with field=form.new_slug %}
</li>
<li>
{% include "wagtailadmin/shared/field.html" with field=form.new_parent_page %}
</li>

{% if form.copy_subpages %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.copy_subpages %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.copy_subpages %}
</li>
{% endif %}

{% if form.publish_copies %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.publish_copies %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.publish_copies %}
</li>
{% endif %}

{% if form.alias %}
{% include "wagtailadmin/shared/field_as_li.html" with field=form.alias %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.alias %}
</li>
{% endif %}
</ul>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
{% csrf_token %}

<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=move_form.new_parent_page %}
<li>
{% include "wagtailadmin/shared/field.html" with field=move_form.new_parent_page %}
</li>
</ul>

<input type="submit" value="{% trans 'Confirm' %}" class="button">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<ul class="fields nice-padding">
{% for field in form %}
{% if not field.is_hidden %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% else %}
{{ field }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<ul class="fields nice-padding">
{% for field in form %}
{% if not field.is_hidden %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% else %}
{{ field }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
<form class="task-search" action="{% url 'wagtailadmin_workflows:task_chooser_results' %}" method="GET" novalidate>
<ul class="fields">
{% for field in search_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
</ul>
</form>
Expand All @@ -48,7 +50,9 @@
<form class="task-search" action="{% url 'wagtailadmin_workflows:task_chooser_results' %}" method="GET" novalidate>
<ul class="fields">
{% for field in search_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
</ul>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endif %}
{% endfor %}
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ <h2>{% trans 'Filter' %}</h2>
{% icon name="spinner" %}{% trans 'Apply filters' %}
</button>
{% for field in select_date_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<ul class="fields">
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}

<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

<ul class="fields">
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}

<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

<ul class="fields">
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}

<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<ul class="fields">
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}

<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<ul class="fields">
{% block visible_fields %}
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endfor %}
{% endblock %}
{% if form.show_submit %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ <h3>Mixtures</h3>
{% if field.name == 'file' %}
{% include "wagtailimages/images/_file_field.html" %}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endif %}
{% endfor %}
<li><button type="submit" class="button">{% trans 'Save' %}</button><a href="#" class="button no">{% trans "Delete image" %}</a></li>
Expand Down
4 changes: 3 additions & 1 deletion wagtail/documents/templates/wagtaildocs/documents/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endif %}
{% endfor %}
<li>
Expand Down
4 changes: 3 additions & 1 deletion wagtail/documents/templates/wagtaildocs/documents/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
{% elif field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" %}
<li>
{% include "wagtailadmin/shared/field.html" %}
</li>
{% endif %}
{% endfor %}
<li>
Expand Down
4 changes: 3 additions & 1 deletion wagtail/embeds/templates/wagtailembeds/chooser/chooser.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
<li>
<button
Expand Down
4 changes: 3 additions & 1 deletion wagtail/images/templates/wagtailimages/chooser/chooser.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<form data-chooser-modal-search action="{{ results_url }}" method="GET" autocomplete="off" novalidate>
<ul class="fields">
{% for field in filter_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
{% if popular_tags %}
<li class="taglist w-label-3">
Expand Down
4 changes: 3 additions & 1 deletion wagtail/images/templates/wagtailimages/images/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
{% if field.is_hidden %}
{{ field }}
{% else %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endif %}
{% endfor %}
<li><input type="submit" value="{% trans 'Save' %}" class="button" /></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<form class="query-search full-width" action="{% url 'wagtailsearch_admin:queries_chooserresults' %}" method="GET" autocomplete="off" novalidate>
<ul class="fields">
{% for field in searchform %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
<li>
{% include "wagtailadmin/shared/field.html" with field=field %}
</li>
{% endfor %}
<li class="submit"><input type="submit" value="{% trans 'Search' %}" class="button" /></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<div class="tab-content">
{% csrf_token %}
<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=form.content %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.content %}
</li>
<li>
<input type="submit" value="Save" class="button"/>
</li>
Expand Down
Loading

0 comments on commit fd93cae

Please sign in to comment.