Consolidate messages and errors in to main page template.

This commit is contained in:
Christopher Charbonneau Wells 2017-12-06 13:01:41 -05:00
parent 1fa3c49f69
commit 553d9fbc3b
4 changed files with 31 additions and 11 deletions

View File

@ -7,6 +7,11 @@
}
}
// Remove extra margin below site breadcrumb.
.breadcrumb {
margin-bottom: 0;
}
// Extra-small button.
.btn-xs {
@include button-size(.2rem, .12rem, .75rem, 1, .2rem);

View File

@ -3,17 +3,6 @@
<div class="container-fluid">
<form role="form" method="post" enctype="multipart/form-data">
{% csrf_token %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="alert alert-danger" role="alert">
<strong>Error:</strong> {{ error }}
</div>
{% endfor %}
{% elif form.errors %}
<div class="alert alert-danger" role="alert">
<strong>Error:</strong> Some fields have errors. See below for details.
</div>
{% endif %}
{% for field in form %}
<div class="form-group row">
{% include 'babybuddy/form_field.html' %}

View File

@ -0,0 +1,25 @@
{% block messages %}
{% if messages %}
{% for message in messages %}
<div class="alert{% if message.tags %} alert-{{ message.tags }}{% endif %} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endif %}
{% if form %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="alert alert-danger" role="alert">
<strong>Error:</strong> {{ error }}
</div>
{% endfor %}
{% elif form.errors %}
<div class="alert alert-danger" role="alert">
<strong>Error:</strong> Some fields have errors. See below for details.
</div>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -5,6 +5,7 @@
<div id="view-{{ request.resolver_match.view_name }}" class="container-fluid">
<div class="row justify-content-md-center">
<div class="col-lg-12 mb-4">
{% include 'babybuddy/messages.html' %}
{% block content %}{% endblock %}
</div>
</div>