merge similar forms into account_form.html
This commit is contained in:
parent
ec0c1d50b8
commit
941be347d3
9 changed files with 66 additions and 90 deletions
|
@ -2,15 +2,25 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% include 'editor/fragment_modal_close.html' %}
|
||||
<h3>{% trans 'Log in' %}</h3>
|
||||
<h3>{{ title }}</h3>
|
||||
|
||||
{% bootstrap_messages %}
|
||||
|
||||
{% if back_url %}
|
||||
<p>
|
||||
<a href="{{ back_url }}">« {% trans 'back' %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{% trans 'Log in' %}</button>
|
||||
<button type="submit" class="btn btn-primary btn-block">{{ title }}</button>
|
||||
</div>
|
||||
<a href="{% url 'editor.register' %}?{{ request.GET.urlencode }}">{% trans 'Create new account' %}</a>
|
||||
{% if bottom_link_url %}
|
||||
<p>
|
||||
<a href="{{ bottom_link_url }}?{{ request.GET.urlencode }}">{{ bottom_link_text }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</form>
|
|
@ -1,17 +0,0 @@
|
|||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
|
||||
{% include 'editor/fragment_modal_close.html' %}
|
||||
<h3>{% trans 'Change password' %}</h3>
|
||||
|
||||
<p>
|
||||
<a href="{% url 'editor.users.detail' pk=request.user.pk %}">« {% trans 'back' %}</a>
|
||||
</p>
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{% trans 'Change password' %}</button>
|
||||
</div>
|
||||
</form>
|
|
@ -1,17 +0,0 @@
|
|||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
|
||||
{% include 'editor/fragment_modal_close.html' %}
|
||||
<h3>{% trans 'Create new account' %}</h3>
|
||||
|
||||
<p>
|
||||
<a href="{% url 'editor.login' %}">« {% trans 'back' %}</a>
|
||||
</p>
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{% trans 'Create new account' %}</button>
|
||||
</div>
|
||||
</form>
|
|
@ -27,7 +27,12 @@ def login_view(request):
|
|||
else:
|
||||
form = AuthenticationForm(request)
|
||||
|
||||
return render(request, 'editor/login.html', {'form': form})
|
||||
return render(request, 'editor/account_form.html', {
|
||||
'title': _('Log in'),
|
||||
'form': form,
|
||||
'bottom_link_url': reverse('site.register'),
|
||||
'bottom_link_text': _('Create new account')
|
||||
})
|
||||
|
||||
|
||||
@sidebar_view
|
||||
|
@ -61,7 +66,11 @@ def register_view(request):
|
|||
for field in form.fields.values():
|
||||
field.help_text = None
|
||||
|
||||
return render(request, 'editor/register.html', {'form': form})
|
||||
return render(request, 'editor/account_form.html', {
|
||||
'title': _('Change new account'),
|
||||
'back_url': reverse('site.login'),
|
||||
'form': form
|
||||
})
|
||||
|
||||
|
||||
@sidebar_view
|
||||
|
@ -81,4 +90,8 @@ def change_password_view(request):
|
|||
for field in form.fields.values():
|
||||
field.help_text = None
|
||||
|
||||
return render(request, 'editor/change_password.html', {'form': form})
|
||||
return render(request, 'editor/account_form.html', {
|
||||
'title': _('Change password'),
|
||||
'back_url': reverse('site.account'),
|
||||
'form': form
|
||||
})
|
||||
|
|
21
src/c3nav/site/templates/site/account_form.html
Normal file
21
src/c3nav/site/templates/site/account_form.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'site/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<main class="account">
|
||||
<h2>{{ title }}</h2>
|
||||
|
||||
{% if back_url %}
|
||||
<p><a href="{{ back_url }}">« {% trans 'back' %}</a></p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button type="submit">{{ title }}</button>
|
||||
{% if bottom_link_url %}
|
||||
<a href="{{ bottom_link_url }}?{{ request.GET.urlencode }}">{{ bottom_link_text }}</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||
{% extends 'site/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<main class="account">
|
||||
<h2>{% trans 'Change password' %}</h2>
|
||||
|
||||
<p><a href="{% url 'site.account' %}">« {% trans 'back' %}</a></p>
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button type="submit">{% trans 'Change password' %}</button>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||
{% extends 'site/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<main class="account">
|
||||
<h2>{% trans 'Log in' %}</h2>
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button type="submit">{% trans 'Log in' %}</button>
|
||||
<a href="{% url 'site.register' %}">{% trans 'Create new account' %}</a>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||
{% extends 'site/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<main class="account">
|
||||
<h2>{% trans 'Create new account' %}</h2>
|
||||
|
||||
<p><a href="{% url 'site.login' %}">« {% trans 'back' %}</a></p>
|
||||
|
||||
<form method="post" action="{{ request.path_info }}?{{ request.GET.urlencode }}">
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<button type="submit">{% trans 'Create new account' %}</button>
|
||||
</form>
|
||||
</main>
|
||||
{% endblock %}
|
|
@ -141,7 +141,12 @@ def login_view(request):
|
|||
else:
|
||||
form = AuthenticationForm(request)
|
||||
|
||||
return render(request, 'site/login.html', {'form': form})
|
||||
return render(request, 'site/account_form.html', {
|
||||
'title': _('Log in'),
|
||||
'form': form,
|
||||
'bottom_link_url': reverse('site.register'),
|
||||
'bottom_link_text': _('Create new account')
|
||||
})
|
||||
|
||||
|
||||
@never_cache
|
||||
|
@ -168,7 +173,11 @@ def register_view(request):
|
|||
for field in form.fields.values():
|
||||
field.help_text = None
|
||||
|
||||
return render(request, 'site/register.html', {'form': form})
|
||||
return render(request, 'site/account_form.html', {
|
||||
'title': _('Change new account'),
|
||||
'back_url': reverse('site.login'),
|
||||
'form': form
|
||||
})
|
||||
|
||||
|
||||
@never_cache
|
||||
|
@ -187,7 +196,11 @@ def change_password_view(request):
|
|||
for field in form.fields.values():
|
||||
field.help_text = None
|
||||
|
||||
return render(request, 'site/change_password.html', {'form': form})
|
||||
return render(request, 'site/account_form.html', {
|
||||
'title': _('Change password'),
|
||||
'back_url': reverse('site.account'),
|
||||
'form': form
|
||||
})
|
||||
|
||||
|
||||
@never_cache
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue