admin: use spinner-button for modal forms

This commit is contained in:
Jens Langhammer 2021-03-02 20:37:23 +01:00
parent 7d296b2119
commit 74d240dfd4
5 changed files with 7 additions and 21 deletions

View File

@ -27,7 +27,9 @@
</div> </div>
</section> </section>
<footer class="pf-c-modal-box__footer"> <footer class="pf-c-modal-box__footer">
<input class="pf-c-button pf-m-primary" type="submit" form="main-form" value="{% block action %}{% endblock %}" /> <ak-spinner-button form="main-form">
{% block action %}{% endblock %}
</ak-spinner-button>&nbsp;
<a class="pf-c-button pf-m-secondary" href="{% back %}">{% trans "Cancel" %}</a> <a class="pf-c-button pf-m-secondary" href="{% back %}">{% trans "Cancel" %}</a>
</footer> </footer>
{% endblock %} {% endblock %}

View File

@ -1,12 +0,0 @@
{% extends "base/skeleton.html" %}
{% load i18n %}
{% block body %}
<ak-message-container></ak-message-container>
<div class="pf-c-page">
<a class="pf-c-skip-to-content pf-c-button pf-m-primary" href="#main-content">{% trans 'Skip to content' %}</a>
{% block page_content %}
{% endblock %}
</div>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends 'base/page.html' %} {% extends 'base/skeleton.html' %}
{% load i18n %} {% load i18n %}
{% load authentik_utils %} {% load authentik_utils %}

View File

@ -1,9 +1,6 @@
{% extends "base/page.html" %}
{% load i18n %} {% load i18n %}
{% load authentik_utils %} {% load authentik_utils %}
{% block body %}
<div class="pf-c-card"> <div class="pf-c-card">
<div class="pf-c-card__header pf-c-title pf-m-md"> <div class="pf-c-card__header pf-c-title pf-m-md">
{% trans 'Reset your password' %} {% trans 'Reset your password' %}
@ -14,4 +11,3 @@
</a> </a>
</div> </div>
</div> </div>
{% endblock %}

View File

@ -59,9 +59,9 @@ export class SpinnerButton extends LitElement {
return; return;
} }
if (this.form) { if (this.form) {
// Because safari we can't just extend HTMLButtonElement, hence I have to implement // Since the form= attribute is only used within a modal button,
// these attributes by myself here, sigh... // we can assume the form is always two levels up
document.querySelector<HTMLFormElement>(`#${this.form}`)?.submit(); this.parentElement?.parentElement?.querySelector < HTMLFormElement>(`#${this.form}`)?.dispatchEvent(new Event("submit"));
} }
this.setLoading(); this.setLoading();
} }