changeset 397:b313a7d343af default tip

bulma (components/common): open external menu links in blank page (new tab).
author Goffi <goffi@goffi.org>
date Thu, 30 May 2024 17:08:21 +0200
parents 9847e6dbeefa
children
files sat_templates/templates/bulma/components/common.html sat_templates/templates/bulma/embed/embed.html
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat_templates/templates/bulma/components/common.html	Wed May 15 17:39:47 2024 +0200
+++ b/sat_templates/templates/bulma/components/common.html	Thu May 30 17:08:21 2024 +0200
@@ -1,5 +1,5 @@
 {% import 'components/menu_labels.html' as ml with context %}
-{# we need to use "with context" to disable cache, needed for i18n #}
+{# We need to use "with context" to disable cache, needed for i18n. #}
 
 {% macro menu(menus, class='has-background-primary') %}
     <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}">
@@ -19,6 +19,8 @@
                 <a
                     class="navbar-item {% if name == current_page %}is-tab is-active{% endif%}"
                     {{ {'href': url}|xmlattr }}
+                    {# External links should not replace current page. #}
+                    {% if url.startswith('http:') or url.startswith('https:') -%}target="_blank"{%- endif %}
                 >
                     {{ml.label[name] or name}}
                   </a>
--- a/sat_templates/templates/bulma/embed/embed.html	Wed May 15 17:39:47 2024 +0200
+++ b/sat_templates/templates/bulma/embed/embed.html	Thu May 30 17:08:21 2024 +0200
@@ -1,6 +1,6 @@
 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
 {% block body_wrapper %}
-    <iframe class="embed" src="{{target_url}}"></iframe>
+    <iframe class="embed" src="{{target_url}}" frameborder="0" allowfullscreen allow-same-origin></iframe>
 {% endblock body_wrapper  %}
 
 {% block footer %}{% endblock footer %}