From 553d9fbc3bf538a826b93473385103fc096716cb Mon Sep 17 00:00:00 2001 From: Christopher Charbonneau Wells Date: Wed, 6 Dec 2017 13:01:41 -0500 Subject: [PATCH] Consolidate messages and errors in to main page template. --- babybuddy/static_src/scss/_global.scss | 5 +++++ babybuddy/templates/babybuddy/form.html | 11 --------- babybuddy/templates/babybuddy/messages.html | 25 +++++++++++++++++++++ babybuddy/templates/babybuddy/page.html | 1 + 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 babybuddy/templates/babybuddy/messages.html diff --git a/babybuddy/static_src/scss/_global.scss b/babybuddy/static_src/scss/_global.scss index d678188a..3afa6c2c 100644 --- a/babybuddy/static_src/scss/_global.scss +++ b/babybuddy/static_src/scss/_global.scss @@ -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); diff --git a/babybuddy/templates/babybuddy/form.html b/babybuddy/templates/babybuddy/form.html index 1c14bc6e..83dc2555 100644 --- a/babybuddy/templates/babybuddy/form.html +++ b/babybuddy/templates/babybuddy/form.html @@ -3,17 +3,6 @@
{% csrf_token %} - {% if form.non_field_errors %} - {% for error in form.non_field_errors %} - - {% endfor %} - {% elif form.errors %} - - {% endif %} {% for field in form %}
{% include 'babybuddy/form_field.html' %} diff --git a/babybuddy/templates/babybuddy/messages.html b/babybuddy/templates/babybuddy/messages.html new file mode 100644 index 00000000..45627ffe --- /dev/null +++ b/babybuddy/templates/babybuddy/messages.html @@ -0,0 +1,25 @@ +{% block messages %} + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + {% if form %} + {% if form.non_field_errors %} + {% for error in form.non_field_errors %} + + {% endfor %} + {% elif form.errors %} + + {% endif %} + {% endif %} +{% endblock %} diff --git a/babybuddy/templates/babybuddy/page.html b/babybuddy/templates/babybuddy/page.html index e71222b2..063b2ae7 100644 --- a/babybuddy/templates/babybuddy/page.html +++ b/babybuddy/templates/babybuddy/page.html @@ -5,6 +5,7 @@
+ {% include 'babybuddy/messages.html' %} {% block content %}{% endblock %}