From 097dee2e3b3debca4e77aac2f252ea1ea4281d0f Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Thu, 6 Jan 2022 18:29:04 +0100
Subject: [PATCH] dismissible message, placved before title

---
 .../locale/en/LC_MESSAGES/django.po           |  5 +++-
 .../locale/fr/LC_MESSAGES/django.po           |  5 +++-
 .../basetheme_bootstrap/basePasteur.html      | 29 ++++++++++---------
 .../pre_content_page_title.example.html       |  7 +++--
 setup.py                                      |  2 +-
 5 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/basetheme_bootstrap/locale/en/LC_MESSAGES/django.po b/basetheme_bootstrap/locale/en/LC_MESSAGES/django.po
index c9bcd2b..cccb51e 100644
--- a/basetheme_bootstrap/locale/en/LC_MESSAGES/django.po
+++ b/basetheme_bootstrap/locale/en/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-01-04 10:43+0000\n"
+"POT-Creation-Date: 2022-01-06 17:27+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -93,6 +93,9 @@ msgstr ""
 msgid "Search"
 msgstr ""
 
+msgid "Close"
+msgstr ""
+
 msgid "L'Institut Pasteur"
 msgstr ""
 
diff --git a/basetheme_bootstrap/locale/fr/LC_MESSAGES/django.po b/basetheme_bootstrap/locale/fr/LC_MESSAGES/django.po
index 811d697..d31079d 100644
--- a/basetheme_bootstrap/locale/fr/LC_MESSAGES/django.po
+++ b/basetheme_bootstrap/locale/fr/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-01-04 10:43+0000\n"
+"POT-Creation-Date: 2022-01-06 17:27+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -95,6 +95,9 @@ msgstr "Rechercher ici"
 msgid "Search"
 msgstr "Rechercher"
 
+msgid "Close"
+msgstr "Fermer"
+
 msgid "L'Institut Pasteur"
 msgstr "L'Institut Pasteur"
 
diff --git a/basetheme_bootstrap/templates/basetheme_bootstrap/basePasteur.html b/basetheme_bootstrap/templates/basetheme_bootstrap/basePasteur.html
index 8b7b3a6..9593a23 100644
--- a/basetheme_bootstrap/templates/basetheme_bootstrap/basePasteur.html
+++ b/basetheme_bootstrap/templates/basetheme_bootstrap/basePasteur.html
@@ -87,12 +87,25 @@
 <!-- Begin page content -->
 <main role="main" class="flex-shrink-0">
     <div class="{% block container-class %}container mb-4{% endblock %}">
-        <div class="row">
+        <div class="row pt-4">
             {% block pre_content_page_title %}
             {% include_if_exists "pre_content_page_title.html"|localize_template "basetheme_bootstrap/pre_content_page_title.example.html" %}
             {% endblock pre_content_page_title %}
+            {% if messages %}
+            <div class="{% block messages_css_classes %}b-2 col-12{% endblock %}">
+                {% for message in messages %}
+                <p class="alert alert-{{ message.tags|tags_to_bootstrap }} alert-dismissible fade show" role="alert">
+                    {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Important: {% endif %}
+                    {{ message|linebreaksbr}}
+                    <button type="button" class="close" data-dismiss="alert" aria-label="{%trans 'Close' %}">
+                        <span aria-hidden="true">&times;</span>
+                    </button>
+                </p>
+                {% endfor %}
+            </div>
+            {% endif %}
             {% block whole_content_page_title %}
-            <div class="pb-2 mt-4 mb-2 col-12">
+            <div class="pb-2 mb-2 col-12">
                 {% block content_page_title %}
                 <div class="border-bottom content-page-title">
                     <h1>{% block page_title %}{% endblock %}</h1>
@@ -101,18 +114,6 @@
                 {% endblock %}
             </div>
             {% endblock %}
-            {% if messages %}
-            <div class="{% block messages_css_classes %}pb-2 mb-2 col-12{% endblock %}">
-                <div class="border-bottom">
-                    {% for message in messages %}
-                    <p class="alert alert-{{ message.tags|tags_to_bootstrap }}">
-                        {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Important: {% endif %}
-                        {{ message|linebreaksbr}}
-                    </p>
-                    {% endfor %}
-                </div>
-            </div>
-            {% endif %}
             {% block content %}{% endblock %}
         </div>
     </div>
diff --git a/basetheme_bootstrap/templates/basetheme_bootstrap/pre_content_page_title.example.html b/basetheme_bootstrap/templates/basetheme_bootstrap/pre_content_page_title.example.html
index 55ca448..872ee8d 100644
--- a/basetheme_bootstrap/templates/basetheme_bootstrap/pre_content_page_title.example.html
+++ b/basetheme_bootstrap/templates/basetheme_bootstrap/pre_content_page_title.example.html
@@ -1,4 +1,7 @@
-<p class="col-12 mt-2 mb-0 alert alert-warning text-center">
+<div class="{{pre_content_css_classes|default:'col-12'}}"><p class="alert alert-warning text-center alert-dismissible fade show" role="alert">
 You can put a message in pre_content_page_title.html say for example: <span class="border">
     You are running branch <code>toto</code>, any data changes made here are not to be kept.</span>. You also can create an empty file.
-</p>
\ No newline at end of file
+  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+    <span aria-hidden="true">&times;</span>
+  </button>
+</p></div>
\ No newline at end of file
diff --git a/setup.py b/setup.py
index fa00399..78fd6bf 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ readme = open('README.rst').read()
 
 setup(
     name='django-basetheme-bootstrap',
-    version='0.2.77',
+    version='0.2.78',
     description='Django Basetheme Bootstrap',
     long_description=readme,
     author='Bryan Brancotte',
-- 
GitLab