mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Move disable to action menu and switch all workflow longrunning buttons to svg
This commit is contained in:
parent
e0c6aab536
commit
9256a9dfbd
@ -1,4 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
{% include "wagtailadmin/shared/header.html" with title=action_verbose icon="clipboard-list" %}
|
||||
|
||||
<div class="nice-padding">
|
||||
@ -6,7 +6,7 @@
|
||||
{% csrf_token %}
|
||||
<ul class="fields">
|
||||
{% include 'wagtailadmin/shared/form_as_ul.html' %}
|
||||
<li><button type="submit" class="button button-longrunning"><span class="icon icon-spinner"></span>{{ action_verbose }}</button></li>
|
||||
<li><button type="submit" class="button button-longrunning">{% icon name="spinner" %}{{ action_verbose }}</button></li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,7 +52,7 @@
|
||||
{% block form_actions %}
|
||||
<div class="dropdown dropup dropdown-button match-width">
|
||||
<button type="submit" class="button action-save button-longrunning" data-clicked-text="{% trans 'Creating…' %}">
|
||||
<span class="icon icon-spinner"></span><em>{% trans 'Create' %}</em>
|
||||
{% icon name="spinner" %}<em>{% trans 'Create' %}</em>
|
||||
</button>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -42,7 +42,7 @@
|
||||
{% block form_actions %}
|
||||
<div class="dropdown dropup dropdown-button match-width">
|
||||
<button type="submit" class="button action-save button-longrunning" data-clicked-text="{% trans 'Creating…' %}">
|
||||
<span class="icon icon-spinner"></span><em>{% trans 'Create' %}</em>
|
||||
{% icon name="spinner" %}<em>{% trans 'Create' %}</em>
|
||||
</button>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -19,6 +19,8 @@
|
||||
{{ edit_handler.html_declarations }}
|
||||
|
||||
{{ view.media.js }}
|
||||
|
||||
{% include "wagtailadmin/workflows/includes/_edit_js.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -78,8 +80,20 @@
|
||||
{% block form_actions %}
|
||||
<div class="dropdown dropup dropdown-button match-width">
|
||||
<button type="submit" class="button action-save button-longrunning" data-clicked-text="{% trans 'Saving…' %}">
|
||||
<span class="icon icon-spinner"></span><em>{% trans 'Save' %}</em>
|
||||
{% icon name="spinner" %}<em>{% trans 'Save' %}</em>
|
||||
</button>
|
||||
<div class="dropdown-toggle">{% icon name="arrow-up" %}</div>
|
||||
<ul>
|
||||
{% if can_enable %}
|
||||
<li>
|
||||
<button type="submit" class="button no" data-enable-action>{{ view.enable_item_label }}</button>
|
||||
</li>
|
||||
{% elif can_disable %}
|
||||
<li>
|
||||
<a href="{{ view.get_delete_url }}" class="button no">{{ view.delete_item_label }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</li>
|
||||
@ -87,20 +101,4 @@
|
||||
</footer>
|
||||
{% endblock %}
|
||||
</form>
|
||||
|
||||
{% if can_enable or can_disable %}
|
||||
<div class="nice-padding">
|
||||
<form action="{{ view.get_enable_url }}" method="POST" novalidate>
|
||||
{% csrf_token %}
|
||||
<p class="actions">
|
||||
{% if can_enable %}
|
||||
<button type="submit" class="button button-secondary no">{{ view.enable_item_label }}</button>
|
||||
{% endif %}
|
||||
{% if can_disable %}
|
||||
<a href="{{ view.get_delete_url }}" class="button button-secondary no">{{ view.delete_item_label }}</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "wagtailadmin/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{% block titletag %}{{ view.page_title }}{% endblock %}
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
{{ edit_handler.html_declarations }}
|
||||
|
||||
{{ view.media.js }}
|
||||
|
||||
{% include "wagtailadmin/workflows/includes/_edit_js.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -52,8 +54,21 @@
|
||||
{% block form_actions %}
|
||||
<div class="dropdown dropup dropdown-button match-width">
|
||||
<button type="submit" class="button action-save button-longrunning" data-clicked-text="{% trans 'Saving…' %}">
|
||||
<span class="icon icon-spinner"></span><em>{% trans 'Save' %}</em>
|
||||
{% icon name="spinner" %}<em>{% trans 'Save' %}</em>
|
||||
</button>
|
||||
|
||||
<div class="dropdown-toggle">{% icon name="arrow-up" %}</div>
|
||||
<ul>
|
||||
{% if can_enable %}
|
||||
<li>
|
||||
<button type="submit" class="button no" data-enable-action>{{ view.enable_item_label }}</button>
|
||||
</li>
|
||||
{% elif can_disable %}
|
||||
<li>
|
||||
<a href="{{ view.get_delete_url }}" class="button no">{{ view.delete_item_label }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</li>
|
||||
@ -61,19 +76,4 @@
|
||||
</footer>
|
||||
{% endblock %}
|
||||
</form>
|
||||
{% if can_enable or can_disable %}
|
||||
<div class="nice-padding">
|
||||
<form action="{{ view.get_enable_url }}" method="POST" novalidate>
|
||||
{% csrf_token %}
|
||||
<p class="actions">
|
||||
{% if can_enable %}
|
||||
<button type="submit" class="button button-secondary no">{{ view.enable_item_label }}</button>
|
||||
{% endif %}
|
||||
{% if can_disable %}
|
||||
<a href="{{ view.get_delete_url }}" class="button button-secondary no">{{ view.delete_item_label }}</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,25 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('[data-enable-action]').forEach(function (buttonElement) {
|
||||
buttonElement.addEventListener('click', function (e) {
|
||||
// Stop the button from submitting the form
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var formElement = document.createElement('form');
|
||||
|
||||
formElement.action = '{{ view.get_enable_url }}';
|
||||
formElement.method = 'POST';
|
||||
|
||||
var csrftokenElement = document.createElement('input');
|
||||
csrftokenElement.type = 'hidden';
|
||||
csrftokenElement.name = 'csrfmiddlewaretoken';
|
||||
csrftokenElement.value = '{{ csrf_token|escapejs }}';
|
||||
formElement.appendChild(csrftokenElement);
|
||||
|
||||
document.body.appendChild(formElement);
|
||||
formElement.submit();
|
||||
}, {capture: true});
|
||||
})
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user