mirror of https://github.com/snachodog/mybuddy.git
Consolidate messages and errors in to main page template.
This commit is contained in:
parent
1fa3c49f69
commit
553d9fbc3b
|
@ -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);
|
||||
|
|
|
@ -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' %}
|
||||
|
|
|
@ -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">×</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 %}
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue