ui: update remaining forms, completely remove jQuery

This commit is contained in:
Jens Langhammer 2020-02-24 13:13:28 +01:00
parent 8433b5e583
commit 155c9a4c3f
3 changed files with 57 additions and 58 deletions

View file

@ -4,25 +4,16 @@
{% load i18n %} {% load i18n %}
{% load utils %} {% load utils %}
{% block head %}
{{ block.super }}
<style>
.pf-icon {
font-size: 48px;
text-align: center;
}
</style>
{% endblock %}
{% block card %} {% block card %}
<header class="login-pf-header"> <form method="POST" class="pf-c-form">
<h1>{% trans title %}</h1>
</header>
<form method="POST">
{% csrf_token %} {% csrf_token %}
{% include 'partials/form.html' %} {% include 'partials/form.html' %}
<span class="pf-icon pficon-error-circle-o btn-block"></span> <div class="pf-c-form__group">
Access denied <p>
<i class="pf-icon pf-icon-error-circle-o"></i>
{% trans 'Access denied' %}
</p>
</div>
{% if 'back' in request.GET %} {% if 'back' in request.GET %}
<a href="{% back %}" class="btn btn-primary btn-block btn-lg">{% trans 'Back' %}</a> <a href="{% back %}" class="btn btn-primary btn-block btn-lg">{% trans 'Back' %}</a>
{% endif %} {% endif %}

View file

@ -3,15 +3,12 @@
{% load utils %} {% load utils %}
{% load i18n %} {% load i18n %}
{% block title %} {% block card_title %}
{% title 'Authorize Application' %} {% title 'Authorize Application' %}
{% endblock %} {% endblock %}
{% block card %} {% block card %}
<header class="login-pf-header"> <form method="POST" class="pf-c-form">
<h1>{% trans 'Authorize Application' %}</h1>
</header>
<form method="POST">
{% csrf_token %} {% csrf_token %}
{% if not error %} {% if not error %}
{% csrf_token %} {% csrf_token %}
@ -20,32 +17,40 @@
{{ field }} {{ field }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<div class="form-group"> <div class="pf-c-form__group">
<p class="subtitle"> <p class="subtitle">
{% blocktrans with remote=application.name %} {% blocktrans with remote=application.name %}
You're about to sign into {{ remote }} You're about to sign into {{ remote }}.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p>{% trans "Application requires following permissions" %}</p> <p>{% trans "Application requires following permissions" %}</p>
<ul> <ul class="pf-c-list">
{% for scope in scopes_descriptions %} {% for scope in scopes_descriptions %}
<li>{{ scope }}</li> <li>{{ scope }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{{ form.errors }} {{ form.errors }}
{{ form.non_field_errors }} {{ form.non_field_errors }}
</div>
<div class="pf-c-form__group">
<p> <p>
{% blocktrans with user=user %} {% blocktrans with user=user %}
You are logged in as {{ user }}. Not you? You are logged in as {{ user }}. Not you?
{% endblocktrans %} {% endblocktrans %}
<a href="{% url 'passbook_core:auth-logout' %}">{% trans 'Logout' %}</a> <a href="{% url 'passbook_core:auth-logout' %}">{% trans 'Logout' %}</a>
</p> </p>
<div class="form-group">
<input type="submit" class="btn btn-success btn-disabled btn-lg click-spinner" name="allow" value="{% trans 'Continue' %}">
<a href="{% back %}" class="btn btn-default btn-lg">{% trans "Cancel" %}</a>
</div> </div>
<div class="form-group spinner-hidden hidden"> <div class="pf-c-form__group pf-m-action">
<div class="spinner"></div> <input type="submit" class="pf-c-button pf-m-primary" name="allow" value="{% trans 'Continue' %}">
<a href="{% back %}" class="pf-c-button pf-m-secondary">{% trans "Cancel" %}</a>
</div>
<div class="pf-c-form__group" style="display: none;" id="loading">
<div class="pf-c-form__horizontal-group">
<span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>
<span class="pf-c-spinner__tail-ball"></span>
</span>
</div> </div>
</div> </div>
{% else %} {% else %}
@ -61,9 +66,8 @@
{% block scripts %} {% block scripts %}
<script> <script>
$('.click-spinner').on('click', function (e) { document.querySelector("form").addEventListener("submit", (e) => {
$('.spinner-hidden').removeClass('hidden'); document.getElementById("loading").removeAttribute("style");
$(e.target).addClass('disabled'); });
})
</script> </script>
{% endblock %} {% endblock %}

View file

@ -3,15 +3,12 @@
{% load utils %} {% load utils %}
{% load i18n %} {% load i18n %}
{% block title %} {% block card_title %}
{% title 'Authorize Application' %} {% trans 'Authorize Application' %}
{% endblock %} {% endblock %}
{% block card %} {% block card %}
<header class="login-pf-header"> <form method="POST" class="pf-c-form">
<h1>{% trans 'Authorize Application' %}</h1>
</header>
<form method="POST">
{% csrf_token %} {% csrf_token %}
{% if not error %} {% if not error %}
{% csrf_token %} {% csrf_token %}
@ -20,14 +17,14 @@
{{ field }} {{ field }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<div class="form-group"> <div class="pf-c-form__group">
<p class="subtitle"> <p class="subtitle">
{% blocktrans with remote=client.name %} {% blocktrans with remote=client.name %}
You're about to sign into {{ remote }} You're about to sign into {{ remote }}.
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<p>{% trans "Application requires following permissions" %}</p> <p>{% trans "Application requires following permissions" %}</p>
<ul> <ul class="pf-c-list">
{% for scope in scopes %} {% for scope in scopes %}
<li>{{ scope.name }}</li> <li>{{ scope.name }}</li>
{% endfor %} {% endfor %}
@ -35,18 +32,26 @@
{{ hidden_inputs }} {{ hidden_inputs }}
{{ form.errors }} {{ form.errors }}
{{ form.non_field_errors }} {{ form.non_field_errors }}
</div>
<div class="pf-c-form__group">
<p> <p>
{% blocktrans with user=user %} {% blocktrans with user=user %}
You are logged in as {{ user }}. Not you? You are logged in as {{ user }}. Not you?
{% endblocktrans %} {% endblocktrans %}
<a href="{% url 'passbook_core:auth-logout' %}">{% trans 'Logout' %}</a> <a href="{% url 'passbook_core:auth-logout' %}">{% trans 'Logout' %}</a>
</p> </p>
<div class="form-group">
<input type="submit" class="btn btn-success btn-disabled btn-lg click-spinner" name="allow" value="{% trans 'Continue' %}">
<a href="{% back %}" class="btn btn-default btn-lg">{% trans "Cancel" %}</a>
</div> </div>
<div class="form-group spinner-hidden hidden"> <div class="pf-c-form__group pf-m-action">
<div class="spinner"></div> <input type="submit" class="pf-c-button pf-m-primary" name="allow" value="{% trans 'Continue' %}">
<a href="{% back %}" class="pf-c-button pf-m-secondary">{% trans "Cancel" %}</a>
</div>
<div class="pf-c-form__group" style="display: none;" id="loading">
<div class="pf-c-form__horizontal-group">
<span class="pf-c-spinner" role="progressbar" aria-valuetext="Loading...">
<span class="pf-c-spinner__clipper"></span>
<span class="pf-c-spinner__lead-ball"></span>
<span class="pf-c-spinner__tail-ball"></span>
</span>
</div> </div>
</div> </div>
{% else %} {% else %}
@ -62,9 +67,8 @@
{% block scripts %} {% block scripts %}
<script> <script>
$('.click-spinner').on('click', function (e) { document.querySelector("form").addEventListener("submit", (e) => {
$('.spinner-hidden').removeClass('hidden'); document.getElementById("loading").removeAttribute("style");
$(e.target).addClass('disabled'); });
})
</script> </script>
{% endblock %} {% endblock %}