From 4f85bef8128a8418ffe3d7e058fd7203573faf77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Sat, 11 Apr 2020 10:44:38 +0200
Subject: [PATCH] templates: reduce duplication of messages block (#41618)

---
 static/includes/_misc.scss                          |  2 +-
 static/minint/initial.css                           |  4 ++--
 templates/authentic2/base.html                      | 12 ------------
 templates/combo/page_template.html                  | 13 +++++++++++--
 templates/fargo/base.html                           | 12 ------------
 templates/theme.html                                |  4 ++--
 .../variants/grenoble-metropole-2019/theme.html     |  9 ---------
 templates/variants/hautes-alpes-2018/theme.html     |  9 ---------
 templates/variants/minint/theme.html                |  9 ---------
 templates/variants/montpellier/base.html            | 12 ------------
 templates/variants/montpellier/theme.html           |  9 ---------
 templates/variants/strasbourg-2018/theme.html       |  9 ---------
 templates/variants/villeurbanne-2018/theme.html     |  9 ---------
 13 files changed, 16 insertions(+), 97 deletions(-)

diff --git a/static/includes/_misc.scss b/static/includes/_misc.scss
index c6dc4248..b7da3340 100644
--- a/static/includes/_misc.scss
+++ b/static/includes/_misc.scss
@@ -272,7 +272,7 @@ div#page-change-overlay.on {
 	box-sizing: content-box;
 	background: $color;
 	color: text-color($color);
-	margin: 1rem 0;
+	margin: 0 0 1rem 0;
 	padding: 0.5rem;
 	padding-left: 4rem;
 	position: relative;
diff --git a/static/minint/initial.css b/static/minint/initial.css
index fc5855cf..bd89218f 100644
--- a/static/minint/initial.css
+++ b/static/minint/initial.css
@@ -466,10 +466,10 @@ table.announces tbody th {
   top: 120px;
   left: 1200px; }
 
-#messages.messages-login {
+#messages {
   position: static; }
 
-#messages.messages-login li {
+#messages li {
   margin: 0px;
   margin-left: 100px;
   margin-right: 100px; }
diff --git a/templates/authentic2/base.html b/templates/authentic2/base.html
index 6a902dbd..21579811 100644
--- a/templates/authentic2/base.html
+++ b/templates/authentic2/base.html
@@ -12,18 +12,6 @@
   {% endblock %}
 {% endblock %}
 
-{% block messages %}
-{% if messages %}
-  <div id="messages" class="messages-login">
-    <ul class="messages">
-      {% for message in messages %}
-      <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-      {% endfor %}
-    </ul>
-  </div>
-{% endif %}
-{% endblock %}
-
 {% block extra-top-head %}
   {% block extrascripts %}
   {% endblock %}
diff --git a/templates/combo/page_template.html b/templates/combo/page_template.html
index 557f3b7a..a8ff5732 100644
--- a/templates/combo/page_template.html
+++ b/templates/combo/page_template.html
@@ -99,8 +99,17 @@ page-{{ page.slug }} page-template-{{ page.template_name }} {% with pages.0.slug
 {% endblock %}
 
 {% block messages %}
-{{ block.super }}
-{% placeholder "messages" %}
+{% skeleton_extra_placeholder messages %}
+{% if messages %}
+  <div id="messages">
+    <ul class="messages">
+        {% for message in messages %}
+        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}><p>{{ message }}</p></li>
+        {% endfor %}
+    </ul>
+  </div>
+{% endif %}
+{% end_skeleton_extra_placeholder %}
 {% endblock %}
 
 {% block content %}
diff --git a/templates/fargo/base.html b/templates/fargo/base.html
index 1bf25970..aa9e94e8 100644
--- a/templates/fargo/base.html
+++ b/templates/fargo/base.html
@@ -1,13 +1 @@
 {% extends theme_base %}
-
-{% block messages %}
-{% if messages %}
-  <div id="messages" class="messages-login">
-    <ul class="messages">
-      {% for message in messages %}
-      <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-      {% endfor %}
-    </ul>
-  </div>
-{% endif %}
-{% endblock %}
diff --git a/templates/theme.html b/templates/theme.html
index a12fd9db..e11a3e89 100644
--- a/templates/theme.html
+++ b/templates/theme.html
@@ -116,10 +116,10 @@
 {% block content-messages %}
 {% block messages %}
 {% if messages %}
-  <div id="messages" class="messages-login">
+  <div id="messages">
     <ul class="messages">
         {% for message in messages %}
-        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
+        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}><p>{{ message }}</p></li>
         {% endfor %}
     </ul>
   </div>
diff --git a/templates/variants/grenoble-metropole-2019/theme.html b/templates/variants/grenoble-metropole-2019/theme.html
index 42eada54..cb808dcf 100644
--- a/templates/variants/grenoble-metropole-2019/theme.html
+++ b/templates/variants/grenoble-metropole-2019/theme.html
@@ -69,15 +69,6 @@
 <div id="main-content-wrapper">
   <div id="main-content">
     {% block messages %}
-    {% if messages %}
-    <div id="messages">
-      <ul class="messages">
-        {% for message in messages %}
-      <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-      {% endfor %}
-      </ul>
-    </div>
-    {% endif %}
     {% endblock %}
     <div id="content" class="gru-content">
       {% block content %}
diff --git a/templates/variants/hautes-alpes-2018/theme.html b/templates/variants/hautes-alpes-2018/theme.html
index b2f8e113..ce63109a 100644
--- a/templates/variants/hautes-alpes-2018/theme.html
+++ b/templates/variants/hautes-alpes-2018/theme.html
@@ -51,15 +51,6 @@
 {% endblock %}
 
 {% block messages %}
-{% if messages %}
-<div id="messages">
-  <ul class="messages">
-      {% for message in messages %}
-      <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-      {% endfor %}
-  </ul>
-</div>
-{% endif %}
 {% endblock %}
 
 {% block local-content-wrapper %}
diff --git a/templates/variants/minint/theme.html b/templates/variants/minint/theme.html
index 5116799e..05b84ae8 100644
--- a/templates/variants/minint/theme.html
+++ b/templates/variants/minint/theme.html
@@ -136,15 +136,6 @@
       <div id="main-content" role="main">
 
 {% block messages %}
-{% if messages %}
-  <div id="messages" class="messages-login">
-    <ul class="messages">
-        {% for message in messages %}
-        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-        {% endfor %}
-    </ul>
-  </div>
-{% endif %}
 {% endblock %}
 
             {% block content %}
diff --git a/templates/variants/montpellier/base.html b/templates/variants/montpellier/base.html
index 7a8a772b..ffdec72b 100644
--- a/templates/variants/montpellier/base.html
+++ b/templates/variants/montpellier/base.html
@@ -19,15 +19,3 @@
           </span>
           {% endif %}
 {% endblock %}
-
-{% block messages %}
-{% if messages %}
-  <div id="messages" class="messages-login">
-    <ul class="messages">
-      {% for message in messages %}
-      <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-      {% endfor %}
-    </ul>
-  </div>
-{% endif %}
-{% endblock %}
diff --git a/templates/variants/montpellier/theme.html b/templates/variants/montpellier/theme.html
index 611ee149..f03a06e8 100644
--- a/templates/variants/montpellier/theme.html
+++ b/templates/variants/montpellier/theme.html
@@ -50,15 +50,6 @@
       <div id="main-content-wrapper">
 
         {% block messages %}
-          {% if messages %}
-            <div id="messages">
-              <ul class="messages">
-                  {% for message in messages %}
-                  <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-                  {% endfor %}
-              </ul>
-            </div>
-          {% endif %}
         {% endblock %}
 
         <div id="nav" class="gru-nav togglable">
diff --git a/templates/variants/strasbourg-2018/theme.html b/templates/variants/strasbourg-2018/theme.html
index b26430cb..256e3af7 100644
--- a/templates/variants/strasbourg-2018/theme.html
+++ b/templates/variants/strasbourg-2018/theme.html
@@ -125,15 +125,6 @@
             </a>
 
     {% block messages %}
-    {% if messages %}
-      <div id="messages">
-        <ul class="messages">
-            {% for message in messages %}
-            <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-            {% endfor %}
-        </ul>
-      </div>
-    {% endif %}
     {% endblock %}
 
     <div class="large">
diff --git a/templates/variants/villeurbanne-2018/theme.html b/templates/variants/villeurbanne-2018/theme.html
index 5e801539..da18ca42 100644
--- a/templates/variants/villeurbanne-2018/theme.html
+++ b/templates/variants/villeurbanne-2018/theme.html
@@ -47,15 +47,6 @@
 <div id="main-content-wrapper">
   <div id="main-content">
     {% block messages %}
-    {% if messages %}
-    <div id="messages">
-      <ul class="messages">
-        {% for message in messages %}
-        <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
-        {% endfor %}
-      </ul>
-    </div>
-    {% endif %}
     {% endblock %}
     <div id="content" class="gru-content">
       {% block content %}
-- 
2.26.0

