open most links from modal in a new tab (fixes #96, fixes #97)

This commit is contained in:
Gwendolyn 2023-12-06 14:34:27 +01:00
parent b2a0ca71ba
commit 7059785c34
2 changed files with 6 additions and 3 deletions

View file

@ -1275,9 +1275,12 @@ c3nav = {
history.back();
}
},
_href_modal_open_tab: function(location) {
return ['/l/', '/control/', '/reports/', '/mesh/', '/positions/', '/api-secrets/', '/editor/'].some(prefix => location.startsWith(prefix));
},
_modal_link_click: function(e) {
var location = $(this).attr('href');
if ($(this).is('[target]') || location.startsWith('/control/')) {
if ($(this).is('[target]') || c3nav._href_modal_open_tab(location)) {
$(this).attr('target', '_blank');
return;
}

View file

@ -42,10 +42,10 @@
<hr>
<p>
<a class="button" target="_blank" href="{% url 'site.position_list' %}">{% trans 'Manage custom positions' %}</a>
<a class="button" href="{% url 'site.position_list' %}">{% trans 'Manage custom positions' %}</a>
</p>
<p>
<a class="button" target="_blank" href="{% url 'site.api_secret_list' %}">{% trans 'Manage API secrets' %}</a>
<a class="button" href="{% url 'site.api_secret_list' %}">{% trans 'Manage API secrets' %}</a>
</p>
<hr>