From fb579d2a45da94000d116fea82875a9e507f47d5 Mon Sep 17 00:00:00 2001 From: Felipe Figueroa Date: Wed, 6 Jan 2021 15:41:36 -0300 Subject: use a single template to handle tiny script inclusion differences --- assets/js/jstree_events.js | 5 +++- assets/sw.dev.js | 12 ++++++---- assets/templates/components/common_body.twig | 1 + assets/templates/components/common_head.twig | 17 +++++++++++++ assets/templates/components/trail.twig | 6 +++-- assets/templates/footer.twig | 6 ++++- assets/templates/header_datatables.twig | 9 ------- assets/templates/header_highlight.twig | 9 ------- assets/templates/header_select2.twig | 10 -------- assets/templates/header_sqledit.twig | 36 +--------------------------- assets/templates/intro_view.twig | 2 +- composer.lock | 2 +- src/classes/ViewManager.php | 2 +- src/router.php | 5 +--- src/xhtml/HTMLHeaderController.php | 4 +++- 15 files changed, 46 insertions(+), 80 deletions(-) delete mode 100644 assets/templates/header_datatables.twig delete mode 100644 assets/templates/header_highlight.twig delete mode 100644 assets/templates/header_select2.twig diff --git a/assets/js/jstree_events.js b/assets/js/jstree_events.js index f8899208..dfb3e3ef 100644 --- a/assets/js/jstree_events.js +++ b/assets/js/jstree_events.js @@ -25,7 +25,10 @@ if (parent.frames && parent.frames.detail) { $('#lazy').on('activate_node.jstree', function (e, data) { if (window.parent.frames.detail) { - window.parent.frames.detail.location.replace(data.node.a_attr.href); + let { frameLocation } = window.parent.frames.detail, + nextLocation = data.node.a_attr.href; + console.log({ nextLocation }); + (frameLocation || globalThis.location).replace(nextLocation); } }); $('#lazy').on('state_ready.jstree', function (e, data) { diff --git a/assets/sw.dev.js b/assets/sw.dev.js index 48548faf..3a0e998a 100644 --- a/assets/sw.dev.js +++ b/assets/sw.dev.js @@ -11,12 +11,14 @@ registerRoute( request.destination === 'image' || url.includes('assets/vendor'), new CacheFirst() ); -/*registerRoute( - ({ request }) => - request.destination === 'script' || request.destination === 'style', +registerRoute( + ({ request }) => request.destination === 'style', new StaleWhileRevalidate() -);*/ - +); +registerRoute( + ({ request }) => request.destination === 'script', + new StaleWhileRevalidate() +); registerRoute( ({ url }) => url.origin === 'https://fonts.googleapis.com' || diff --git a/assets/templates/components/common_body.twig b/assets/templates/components/common_body.twig index 81028d83..e88f382b 100644 --- a/assets/templates/components/common_body.twig +++ b/assets/templates/components/common_body.twig @@ -20,3 +20,4 @@

Your browser does not support iframes.

#} {% endif %} + \ No newline at end of file diff --git a/assets/templates/components/common_head.twig b/assets/templates/components/common_head.twig index 514d3d87..569033dc 100644 --- a/assets/templates/components/common_head.twig +++ b/assets/templates/components/common_head.twig @@ -11,6 +11,23 @@ + +{% if headertemplate == 'header_datatables.twig' %} + + + + + {% endif %} + {% if headertemplate == 'header_select2.twig' %} + + + + {% endif %} + {% if headertemplate == 'header_highlight.twig' %} + + + + {% endif %}