0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Convert pages footer actions to dropdown_button

This commit is contained in:
Thibaud Colas 2024-01-12 07:15:39 +00:00
parent b68735a3be
commit e801e6cec4
6 changed files with 20 additions and 24 deletions

View File

@ -8,12 +8,14 @@ describe('DropdownController', () => {
beforeEach(async () => {
document.body.innerHTML = `
<div data-controller="w-dropdown" data-w-dropdown-theme-value="dropdown" data-action="custom:show->w-dropdown#show custom:hide->w-dropdown#hide">
<button id="toggle" type="button" data-w-dropdown-target="toggle" aria-label="Actions"></button>
<div data-w-dropdown-target="content">
<a href="/">Option</a>
<section>
<div data-controller="w-dropdown" data-w-dropdown-theme-value="dropdown" data-action="custom:show->w-dropdown#show custom:hide->w-dropdown#hide">
<button id="toggle" type="button" data-w-dropdown-target="toggle" aria-label="Actions"></button>
<div data-w-dropdown-target="content">
<a href="/">Option</a>
</div>
</div>
</div>`;
</section>`;
application = Application.start();
application.register('w-dropdown', DropdownController);

View File

@ -1,5 +1,5 @@
{% load wagtailadmin_tags i18n %}
<li
<div
class="footer__container footer__container--hidden"
aria-live="polite"
data-controller="w-messages"
@ -30,4 +30,4 @@
</div>
</template>
{% endblock %}
</li>
</div>

View File

@ -1,14 +1,11 @@
{% load wagtailadmin_tags %}
{% if default_menu_item %}
{% if show_menu %}
{% dropdown_button button=default_menu_item toggle_icon="arrow-up" %}
{% for item in rendered_menu_items %}
{{ item }}
{% endfor %}
{% enddropdown_button %}
{% elif default_menu_item %}
{{ default_menu_item }}
{% endif %}
{% if show_menu %}
<div class="dropdown-toggle">{% icon name="arrow-up" %}</div>
<ul>
{% for item in rendered_menu_items %}
<li>
{{ item }}
</li>
{% endfor %}
</ul>
{% endif %}

View File

@ -27,9 +27,7 @@
<nav aria-label="{% trans 'Actions' %}">
<ul>
<li class="actions actions--primary">
<div class="dropdown dropup dropdown-button match-width {% if is_revision %}warning{% endif %}">
{{ action_menu.render_html }}
</div>
{{ action_menu.render_html }}
</li>
{% block extra_footer_actions %}

View File

@ -28,9 +28,7 @@
<nav aria-label="{% trans 'Actions' %}">
<ul>
<li class="actions actions--primary">
<div class="dropdown dropup dropdown-button match-width {% if is_revision %}warning{% endif %}">
{{ action_menu.render_html }}
</div>
{{ action_menu.render_html }}
</li>
{% block extra_footer_actions %}

View File

@ -77,6 +77,7 @@ def revisions_revert(request, page_id, revision_id):
action_menu = PageActionMenu(
request,
view="revisions_revert",
is_revision=True,
page=page,
lock=lock,
locked_for_user=lock is not None and lock.for_user(request.user),