Refactor loging form
This commit is contained in:
parent
4bec9a9079
commit
9500a40363
6 changed files with 89 additions and 75 deletions
|
|
@ -4,21 +4,6 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main id="login--page" class="main">
|
<main id="login--page" class="main">
|
||||||
<form class="form login-form" method="POST" action="{% url 'accounts:login' %}">
|
{% include "form/login-form.html" with form=form title="Login" confirm_text="Login" %}
|
||||||
{% csrf_token %}
|
|
||||||
<div class="form__header">
|
|
||||||
<h1 class="form__title">Login</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<fieldset class="login-form__fieldset">
|
|
||||||
{{ form }}
|
|
||||||
</fieldset>
|
|
||||||
<fieldset class="login-form__fieldset">
|
|
||||||
<button class="button button--confirm" type="submit">Login</button>
|
|
||||||
<a class="link" href="{% url 'accounts:password-reset' %}">
|
|
||||||
<small class="small">I forgot my password</small>
|
|
||||||
</a>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</main>
|
</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
.login-form {
|
|
||||||
@extend .form;
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
margin: 0;
|
|
||||||
padding: 20px 24px 5px 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__fieldset {
|
|
||||||
@extend .form__fieldset;
|
|
||||||
|
|
||||||
& label {
|
|
||||||
@extend .label;
|
|
||||||
}
|
|
||||||
|
|
||||||
& input {
|
|
||||||
@extend .input;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__fieldset:last-child {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__fieldset:last-child {
|
|
||||||
.button {
|
|
||||||
padding: 10px 50px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
@import "rules-form";
|
@import "rules-form";
|
||||||
@import "import-form";
|
@import "import-form";
|
||||||
|
|
||||||
@import "login-form";
|
|
||||||
@import "activation-form";
|
@import "activation-form";
|
||||||
@import "register-form";
|
@import "register-form";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,29 @@
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
||||||
|
& .form {
|
||||||
|
@extend .form;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px 24px 5px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__section {
|
||||||
|
&--last {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__fieldset {
|
||||||
|
@extend .form__fieldset;
|
||||||
|
|
||||||
|
&--last {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
{% include "form/title.html" with title=title only %}
|
{% include "form/title.html" with title=title only %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% block fields %}
|
||||||
<section class="section form__section">
|
<section class="section form__section">
|
||||||
{% for field in form.hidden_fields %}
|
{% for field in form.hidden_fields %}
|
||||||
{{ field }}
|
{{ field }}
|
||||||
|
|
@ -28,14 +29,24 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</section>
|
</section>
|
||||||
|
{% endblock fields %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
<section class="section form__section--last">
|
<section class="section form__section--last">
|
||||||
<fieldset class="fieldset form__fieldset">
|
<fieldset class="fieldset form__fieldset">
|
||||||
{% if cancel_url %}
|
{% if cancel_url %}
|
||||||
<a class="link button button--cancel" href="{{ cancel_url }}">{% trans "Cancel" %}</a>
|
<a class="link button button--cancel" href="{{ cancel_url }}">{% trans "Cancel" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<button class="button button--confirm">{% trans "Save" %}</button>
|
<button class="button button--confirm">
|
||||||
|
{% if confirm_text %}
|
||||||
|
{{ confirm_text }}
|
||||||
|
{% else %}
|
||||||
|
{% trans "Save" %}
|
||||||
|
{% endif %}
|
||||||
|
</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
|
{% endblock actions %}
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
27
src/newsreader/templates/form/login-form.html
Normal file
27
src/newsreader/templates/form/login-form.html
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{% extends "form/form.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
<section class="section form__section--last">
|
||||||
|
<fieldset class="fieldset form__fieldset">
|
||||||
|
{% if cancel_url %}
|
||||||
|
<a class="link button button--cancel" href="{{ cancel_url }}">{% trans "Cancel" %}</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<button class="button button--confirm">
|
||||||
|
{% if confirm_text %}
|
||||||
|
{{ confirm_text }}
|
||||||
|
{% else %}
|
||||||
|
{% trans "Save" %}
|
||||||
|
{% endif %}
|
||||||
|
</button>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="fieldset form__fieldset">
|
||||||
|
<a class="link" href="{% url 'accounts:password-reset' %}">
|
||||||
|
<small class="small">I forgot my password</small>
|
||||||
|
</a>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
|
{% endblock actions %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue