From 07b22439323897e361ff32bc42504efe94ed38b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 12 Aug 2018 16:20:43 +0200 Subject: [PATCH 2/2] templates: declare service worker when a pwa display mode is requested (#25343) --- static/grandlyon-gnm/extra.js | 11 ----------- static/toodego/extra.js | 13 ------------- templates/combo/page_template.html | 20 ++++++++++++++++++++ templates/theme.html | 5 +++++ templates/variants/grandlyon-gnm/theme.html | 1 - templates/variants/toodego/theme.html | 1 - 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/static/grandlyon-gnm/extra.js b/static/grandlyon-gnm/extra.js index 99a1634..ad81cdf 100644 --- a/static/grandlyon-gnm/extra.js +++ b/static/grandlyon-gnm/extra.js @@ -565,15 +565,4 @@ $(function() { $('input, select, textarea').on('change', function() { $(this).parents('.widget-with-error').removeClass('widget-with-error'); }); - - /* service worker */ - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('/service-worker.js', {scope: '/'}).then(function(registration) { - // Registration was successful - console.log('ServiceWorker registration successful with scope: ', registration.scope); - }).catch(function(err) { - // registration failed :( - console.log('ServiceWorker registration failed: ', err); - }); - } }); diff --git a/static/toodego/extra.js b/static/toodego/extra.js index a6cd617..ad49c17 100644 --- a/static/toodego/extra.js +++ b/static/toodego/extra.js @@ -347,17 +347,4 @@ $(function() { $('#forms-count').next().text('demandes'); } }); - - - - /* service worker */ - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('/service-worker.js', {scope: '/'}).then(function(registration) { - // Registration was successful - console.log('ServiceWorker registration successful with scope: ', registration.scope); - }).catch(function(err) { - // registration failed :( - console.log('ServiceWorker registration failed: ', err); - }); - } }); diff --git a/templates/combo/page_template.html b/templates/combo/page_template.html index a55fe23..c90234f 100644 --- a/templates/combo/page_template.html +++ b/templates/combo/page_template.html @@ -88,3 +88,23 @@ page-{{ page.slug }} {% if pages %}section-{{pages.0.slug}}{% endif %} {% endif %} {% end_skeleton_extra_placeholder %} {% endblock %} + +{% block body-bottom %} +{% skeleton_extra_placeholder service-worker %} +{% if page %} {# limit this to combo itself #} + {% if pwa_display == "standalone" or pwa_display == "fullscreen" %} + + {% endif %} +{% endif %} +{% end_skeleton_extra_placeholder %} +{% endblock %} diff --git a/templates/theme.html b/templates/theme.html index da9a1b8..82a9060 100644 --- a/templates/theme.html +++ b/templates/theme.html @@ -21,6 +21,9 @@ {% endif %} + {% if pwa_display == "standalone" or pwa_display == "fullscreen" %} + + {% endif %} {% block extra_top_head %} {% endblock %} {{ media }} @@ -139,5 +142,7 @@ {% if environment_label %}{{ environment_label }}{% endif %} Retour en haut de page {% include "includes/tracking.html" %} + {% block body-bottom %} + {% endblock %} diff --git a/templates/variants/grandlyon-gnm/theme.html b/templates/variants/grandlyon-gnm/theme.html index c656095..c51696d 100644 --- a/templates/variants/grandlyon-gnm/theme.html +++ b/templates/variants/grandlyon-gnm/theme.html @@ -2,7 +2,6 @@ {% load static gnm %} {% block extra_top_head %} - diff --git a/templates/variants/toodego/theme.html b/templates/variants/toodego/theme.html index 8e3255c..a82025a 100644 --- a/templates/variants/toodego/theme.html +++ b/templates/variants/toodego/theme.html @@ -2,7 +2,6 @@ {% load static gnm assets %} {% block extra_top_head %} - -- 2.18.0