From dc509c3208a3e502923e959caa12937da9776d10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Thu, 20 Dec 2018 09:48:46 +0100
Subject: [PATCH] templates: use ?<start_timestamp> instead of computer version
 hash (#29238)

---
 debian/control                                              | 2 +-
 templates/combo/page_template.html                          | 6 +++---
 templates/fargo/base_iframe.html                            | 4 ++--
 templates/gadjo/base.html                                   | 3 ++-
 templates/includes/tracking.html                            | 4 ++--
 templates/theme.html                                        | 6 +++---
 templates/variants/alfortville/prepare-template.py          | 4 ++--
 templates/variants/grenoble-metropole/theme.html            | 4 ++--
 .../hautes-alpes-2018/combo/page_template_neutre.html       | 6 +++---
 templates/variants/hautes-alpes-2018/theme.html             | 4 ++--
 templates/variants/montpellier/theme.html                   | 4 ++--
 templates/variants/nancy-2017/prepare-template.py           | 4 ++--
 templates/variants/nancy-2017/theme.html                    | 4 ++--
 templates/variants/strasbourg-2018/combo/page_template.html | 6 +++---
 templates/variants/strasbourg-2018/theme.html               | 4 ++--
 templates/variants/strasbourg/theme.html                    | 4 ++--
 templates/variants/villeurbanne-2018/theme.html             | 4 ++--
 17 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/debian/control b/debian/control
index 1c1b2b2e..bfba64ff 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://git.entrouvert.org/publik-base-theme.git
 
 Package: publik-base-theme
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, python-xstatic-abrilfatface
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-gadjo, python-xstatic-abrilfatface
 Conflicts: python-authentic2 (< 2.1.20.742.gb6ee096-0)
 Breaks: combo (< 0.7.1)
 Description: Publik Base Theme
diff --git a/templates/combo/page_template.html b/templates/combo/page_template.html
index b0403146..168177c7 100644
--- a/templates/combo/page_template.html
+++ b/templates/combo/page_template.html
@@ -16,11 +16,11 @@
 {% endblock %}
 
 {% block extra_scripts %}
-<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{statics_hash}}" async></script>
-<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{statics_hash}}" async></script>
+<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{start_timestamp}}" async></script>
+<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{start_timestamp}}" async></script>
 <script src="{{site_base}}/__services.js"></script>
 {% if not no_extra_js %}
-<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{statics_hash}}" async></script>
+<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{start_timestamp}}" async></script>
 {% endif %}
 {% skeleton_extra_placeholder extra-head %}
 {% end_skeleton_extra_placeholder %}
diff --git a/templates/fargo/base_iframe.html b/templates/fargo/base_iframe.html
index 55547fc0..2b92270b 100644
--- a/templates/fargo/base_iframe.html
+++ b/templates/fargo/base_iframe.html
@@ -4,9 +4,9 @@
     <script src="{% xstatic 'jquery' 'jquery.min.js' %}"></script>
     <link rel="stylesheet" href="{% static "fargo/css/style.css" %}" />
     {% if css_variant %}
-      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{statics_hash}}">
+      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{start_timestamp}}">
     {% else %}
-      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "style.css" %}?{{statics_hash}}">
+      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "style.css" %}?{{start_timestamp}}">
     {% endif %}
     {% block extra_head %}
     {% endblock %}
diff --git a/templates/gadjo/base.html b/templates/gadjo/base.html
index 9b4e335b..0f144452 100644
--- a/templates/gadjo/base.html
+++ b/templates/gadjo/base.html
@@ -1,4 +1,5 @@
 {% extends "gadjo/root.html" %}
+{% load gadjo %}
 
 {% block site-header %}
   <h1 class="breadcrumbs">{% block breadcrumb %}{% endblock %}</h1>
@@ -10,7 +11,7 @@
 {% block extrascripts %}
 {% if manager_homepage_url %}
 <script src="{{manager_homepage_url}}__services.js"></script>
-<script src="{{manager_homepage_url}}static/js/publik.js?{{statics_hash}}"></script>
+<script src="{{manager_homepage_url}}static/js/publik.js?{{start_timestamp}}"></script>
 {% endif %}
 {% endblock %}
 
diff --git a/templates/includes/tracking.html b/templates/includes/tracking.html
index 35b9a5e8..d7346b8b 100644
--- a/templates/includes/tracking.html
+++ b/templates/includes/tracking.html
@@ -1,4 +1,4 @@
-{% load static %}
+{% load gadjo static %}
 
 {% if cnil_compliant_visits_tracking_js %}
    <script type="text/javascript">
@@ -7,7 +7,7 @@
    }
    </script>
  {% elif visits_tracking_js %}
-   <script type="text/javascript" src="{{ site_base }}{% static 'js/cookie_usage_consent.js' %}?{{statics_hash}}"></script>
+   <script type="text/javascript" src="{{ site_base }}{% static 'js/cookie_usage_consent.js' %}?{{start_timestamp}}"></script>
    <script type="text/javascript">
      if (has_consent()) {
       {{ visits_tracking_js|safe }}
diff --git a/templates/theme.html b/templates/theme.html
index deb96aa7..15c9c45e 100644
--- a/templates/theme.html
+++ b/templates/theme.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-{% load i18n static %}
+{% load gadjo i18n static %}
 <html {% if LANGUAGE_CODE %}lang="{{ LANGUAGE_CODE }}"{% endif %} {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
   <head>
     <meta charset="UTF-8"><!-- 🔥 -->
@@ -28,9 +28,9 @@
     {% endblock %}
     {{ media }}
     {% if css_variant %}
-      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{statics_hash}}">
+      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{start_timestamp}}">
     {% else %}
-      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "style.css" %}?{{statics_hash}}">
+      <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "style.css" %}?{{start_timestamp}}">
     {% endif %}
     {% block extra_css %}
     {% endblock %}
diff --git a/templates/variants/alfortville/prepare-template.py b/templates/variants/alfortville/prepare-template.py
index 8a15e79c..9bc95af5 100644
--- a/templates/variants/alfortville/prepare-template.py
+++ b/templates/variants/alfortville/prepare-template.py
@@ -12,7 +12,7 @@ if os.path.exists(FILENAME):
 
 URL = 'https://www.alfortville.fr/?page=gru'
 subprocess.call(['wget', '--quiet', '-O', FILENAME, '--convert-links', URL])
-content = '{% load i18n static combo %}' + open(FILENAME).read().strip()
+content = '{% load gadjo i18n static combo %}' + open(FILENAME).read().strip()
 if len(content) < 500:
     sys.exit(0)
 
@@ -36,7 +36,7 @@ content = content.replace('</head>',
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'alfortville/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'alfortville/style.css' %}?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/grenoble-metropole/theme.html b/templates/variants/grenoble-metropole/theme.html
index 58dac7d2..9a517f4b 100644
--- a/templates/variants/grenoble-metropole/theme.html
+++ b/templates/variants/grenoble-metropole/theme.html
@@ -1,5 +1,5 @@
 {% extends 'base-theme.html' %}
-{% load i18n static combo %}
+{% load gadjo i18n static combo %}
 
 {% block global_title %}
 {% firstof global_title "Grenoble-Alpes Métropole" %} {% block title %}{% endblock %}
@@ -17,7 +17,7 @@
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'grenoble-metropole/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'grenoble-metropole/style.css' %}?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/hautes-alpes-2018/combo/page_template_neutre.html b/templates/variants/hautes-alpes-2018/combo/page_template_neutre.html
index 289a3604..fdf222b1 100644
--- a/templates/variants/hautes-alpes-2018/combo/page_template_neutre.html
+++ b/templates/variants/hautes-alpes-2018/combo/page_template_neutre.html
@@ -9,11 +9,11 @@
 {% endblock %}
 
 {% block extra_scripts %}
-<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{statics_hash}}"></script>
-<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{statics_hash}}"></script>
+<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{start_timestamp}}"></script>
+<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{start_timestamp}}"></script>
 <script src="{{site_base}}/__services.js"></script>
 {% if not no_extra_js %}
-<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{statics_hash}}"></script>
+<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{start_timestamp}}"></script>
 {% endif %}
 {% skeleton_extra_placeholder extra-head %}
 {% end_skeleton_extra_placeholder %}
diff --git a/templates/variants/hautes-alpes-2018/theme.html b/templates/variants/hautes-alpes-2018/theme.html
index 31844886..99e00d60 100644
--- a/templates/variants/hautes-alpes-2018/theme.html
+++ b/templates/variants/hautes-alpes-2018/theme.html
@@ -1,5 +1,5 @@
 {% extends 'base-theme.html' %}
-{% load i18n static combo %}
+{% load gadjo i18n static combo %}
 
 {% block global_title %}
 {% firstof global_title "Hautes-Alpes le département" %} {% block title %}{% endblock %}
@@ -14,7 +14,7 @@
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'hautes-alpes-2018/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'hautes-alpes-2018/style.css' %}?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/montpellier/theme.html b/templates/variants/montpellier/theme.html
index a107ad2a..c35046b5 100644
--- a/templates/variants/montpellier/theme.html
+++ b/templates/variants/montpellier/theme.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-{% load i18n staticfiles %}
+{% load gadjo i18n staticfiles %}
 <html>
   <head>
     <meta charset="UTF-8"><!-- 🔥 -->
@@ -16,7 +16,7 @@
     {% endif %}
     {% block extra_top_head %}
     {% endblock %}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'montpellier/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'montpellier/style.css' %}?{{start_timestamp}}">
     {% if theme_color %}
     <meta name="theme-color" content="{{theme_color}}">
     <meta name="msapplication-navbutton-color" content="{{theme_color}}">
diff --git a/templates/variants/nancy-2017/prepare-template.py b/templates/variants/nancy-2017/prepare-template.py
index 7d11a607..c7b9414d 100644
--- a/templates/variants/nancy-2017/prepare-template.py
+++ b/templates/variants/nancy-2017/prepare-template.py
@@ -12,7 +12,7 @@ if os.path.exists(FILENAME):
 
 URL = 'https://services.nancy.fr/static/_s/skeleton.html'
 subprocess.call(['wget', '--quiet', '-O', FILENAME, '--convert-links', URL])
-content = '{% load i18n static combo %}' + open(FILENAME).read().strip()
+content = '{% load gadjo i18n static combo %}' + open(FILENAME).read().strip()
 if len(content) < 500:
     sys.exit(0)
 
@@ -27,7 +27,7 @@ content = content.replace('<!-- @@HEAD@@ -->',
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'nancy-2017/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'nancy-2017/style.css' %}?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/nancy-2017/theme.html b/templates/variants/nancy-2017/theme.html
index 88d7f625..5dac2928 100644
--- a/templates/variants/nancy-2017/theme.html
+++ b/templates/variants/nancy-2017/theme.html
@@ -1,4 +1,4 @@
-{% load i18n static combo %}<!doctype html>
+{% load gadjo i18n static combo %}<!doctype html>
 <html lang="fr">
 <head>
   <meta charset="utf-8"/>
@@ -27,7 +27,7 @@
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'nancy-2017/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'nancy-2017/style.css' %}?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/strasbourg-2018/combo/page_template.html b/templates/variants/strasbourg-2018/combo/page_template.html
index b574e287..ab89305f 100644
--- a/templates/variants/strasbourg-2018/combo/page_template.html
+++ b/templates/variants/strasbourg-2018/combo/page_template.html
@@ -9,11 +9,11 @@
 {% endblock %}
 
 {% block extra_scripts %}
-<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{statics_hash}}"></script>
-<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{statics_hash}}"></script>
+<script src="{{site_base}}{% static 'js/combo.public.js' %}?{{start_timestamp}}"></script>
+<script src="{{site_base}}{% static 'js/combo.back.js' %}?{{start_timestamp}}"></script>
 <script src="{{site_base}}/__services.js"></script>
 {% if not no_extra_js %}
-<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{statics_hash}}"></script>
+<script src="{{site_base}}{% static "" %}{{css_variant}}/extra.js?{{start_timestamp}}"></script>
 {% endif %}
 {% skeleton_extra_placeholder extra-head %}
 {% end_skeleton_extra_placeholder %}
diff --git a/templates/variants/strasbourg-2018/theme.html b/templates/variants/strasbourg-2018/theme.html
index 92524305..7b1e4bdd 100644
--- a/templates/variants/strasbourg-2018/theme.html
+++ b/templates/variants/strasbourg-2018/theme.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html>{% load i18n static %}
+<!DOCTYPE html>{% load gadjo i18n static %}
 <html {% if LANGUAGE_CODE %}lang="{{ LANGUAGE_CODE }}"{% endif %} {% if LANGUAGE_BIDI %}dir="rtl"{% endif %} class="mseu">
 <head>
     <meta charset="UTF-8">
@@ -23,7 +23,7 @@
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static-2018/stylesheets/bootstrap.min.css">
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static-2018/stylesheets/bootstrap-theme.min.css">
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static-2018/stylesheets/screen.css">
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/strasbourg/theme.html b/templates/variants/strasbourg/theme.html
index 0ffda7c2..c0344215 100644
--- a/templates/variants/strasbourg/theme.html
+++ b/templates/variants/strasbourg/theme.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html>{% load i18n static %}
+<!DOCTYPE html>{% load gadjo i18n static %}
 <html {% if LANGUAGE_CODE %}lang="{{ LANGUAGE_CODE }}"{% endif %} {% if LANGUAGE_BIDI %}dir="rtl"{% endif %} class="seu">
 <head>
     <meta charset="UTF-8">
@@ -23,7 +23,7 @@
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static/stylesheets/bootstrap.min.css">
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static/stylesheets/bootstrap-theme.min.css">
     <link type="text/css" rel="stylesheet" href="{{site_base}}/static/seu-static/stylesheets/screen.css">
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}{{css_variant}}/style.css?{{start_timestamp}}">
     {% block extra_css %}
     {% endblock %}
     {% block extra_scripts %}
diff --git a/templates/variants/villeurbanne-2018/theme.html b/templates/variants/villeurbanne-2018/theme.html
index e5cc5f12..55d19cec 100644
--- a/templates/variants/villeurbanne-2018/theme.html
+++ b/templates/variants/villeurbanne-2018/theme.html
@@ -1,5 +1,5 @@
 {% extends 'base-theme.html' %}
-{% load i18n static combo %}
+{% load gadjo i18n static combo %}
 
 {% block global_title %}
 {% firstof global_title "Villeurbanne" %} {% block title %}{% endblock %}
@@ -20,7 +20,7 @@
     {% block extra_top_head %}
     {% endblock %}
     {{ media }}
-    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'villeurbanne-2018/style.css' %}?{{statics_hash}}">
+    <link rel="stylesheet" type="text/css" href="{{site_base}}{% static 'villeurbanne-2018/style.css' %}?{{start_timestamp}}">
 
     {% block extra_css %}
     {% endblock %}
-- 
2.20.1

