From cdd2adbc73f1db9690307858c701f0c4f50c2294 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Tue, 7 Jun 2022 15:28:28 +0200 Subject: [PATCH] [BS5] remember last nav pill fix --- data/web/js/build/012-api.js | 2 - data/web/js/build/014-mailcow.js | 33 +- .../templates/admin/tab-config-admins.twig | 408 +++++++++--------- data/web/templates/debug.twig | 24 +- 4 files changed, 243 insertions(+), 224 deletions(-) diff --git a/data/web/js/build/012-api.js b/data/web/js/build/012-api.js index 89f2aa4a..8c673f65 100644 --- a/data/web/js/build/012-api.js +++ b/data/web/js/build/012-api.js @@ -318,7 +318,6 @@ $(document).ready(function() { // General API delete actions $(document).on('click', "[data-action='delete_selected']", function(e) { - console.log("delete"); e.preventDefault(); var id = $(this).data('id'); // If clicked element #delete_selected has data-item attribute, it is added to "items" @@ -337,7 +336,6 @@ $(document).ready(function() { if (typeof multi_data[id] == "undefined" || multi_data[id] == "") return; data_array = multi_data[id]; api_url = $(this).data('api-url'); - console.log("delete modal"); $(document).on('show.bs.modal', '#ConfirmDeleteModal', function() { $("#ItemsToDelete").empty(); for (var i in data_array) { diff --git a/data/web/js/build/014-mailcow.js b/data/web/js/build/014-mailcow.js index 6f1682fa..23736844 100644 --- a/data/web/js/build/014-mailcow.js +++ b/data/web/js/build/014-mailcow.js @@ -61,18 +61,38 @@ $(document).ready(function() { // remember last navigation pill (function () { 'use strict'; - if ($('button[data-bs-toggle="tab"]').length) { - $('button[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { + // remember desktop tabs + $('button[data-bs-toggle="tab"]').on('click', function (e) { if ($(this).data('dont-remember') == 1) { return true; } - var id = $(this).parents('[role="tablist"]').attr('id'); + var id = $(this).attr('id'); var key = 'lastTag'; if (id) { key += ':' + id; } - localStorage.setItem(key, $(e.target).attr('data-bs-target').substring(1)); + + var tab_id = $(e.target).attr('data-bs-target').substring(1); + localStorage.setItem(key, tab_id); }); + // remember mobile tabs + $('button[data-bs-target^="#collapse-tab-"]').on('click', function (e) { + // only remember tab if its being opened + if ($(this).hasClass('collapsed')) return false; + var tab_id = $(this).closest('div[role="tabpanel"]').attr('id'); + + if ($(this).data('dont-remember') == 1) { + return true; + } + var id = $(this).attr('id'); + var key = 'lastTag'; + if (id) { + key += ':' + id; + } + + localStorage.setItem(key, tab_id); + }); + // open last tab $('[role="tablist"]').each(function (idx, elem) { var id = $(elem).attr('id'); var key = 'lastTag'; @@ -81,10 +101,11 @@ $(document).ready(function() { } var lastTab = localStorage.getItem(key); if (lastTab) { - $("[id^=" + lastTab + "]").show(); + $('[data-bs-target="#' + lastTab + '"]').click(); + var tab = $('[id^="' + lastTab + '"]'); + $(tab).find('.card-body.collapse').collapse('show'); } }); - } })(); // IE fix to hide scrollbars when table body is empty diff --git a/data/web/templates/admin/tab-config-admins.twig b/data/web/templates/admin/tab-config-admins.twig index 7d431317..353a903c 100644 --- a/data/web/templates/admin/tab-config-admins.twig +++ b/data/web/templates/admin/tab-config-admins.twig @@ -1,230 +1,230 @@
-
-
- - {{ lang.admin.admin_details }} +
+
+ + {{ lang.admin.admin_details }} +
+
+
+ -
-
-
-
- {{ lang.mailbox.toggle_all }} - {{ lang.mailbox.quick_actions }} + + {# TFA #} + + {{ lang.tfa.tfa }} + +
+
+
{{ lang.tfa.tfa }}:
+
+

{{ tfa_data.pretty }}

+ {% include 'tfa_keys.twig' %} +
+
+
+
+
{{ lang.tfa.set_tfa }}:
+
+ +
+
+ + {# FIDO2 #} + + + {{ lang.fido2.fido2_auth }}
+
+
{{ lang.fido2.known_ids }}:
+
+
+ + + + + + {% include 'fido2.twig' %} +
ID{{ lang.admin.action }}
+
+
+
+
+ + - {# TFA #} - - {{ lang.tfa.tfa }} - -
-
-
{{ lang.tfa.tfa }}:
-
-

{{ tfa_data.pretty }}

- {% include 'tfa_keys.twig' %} -
-
-
-
-
{{ lang.tfa.set_tfa }}:
-
- -
+
+
{{ lang.fido2.register_status }}:
+
+
-
+
+
- {# FIDO2 #} - - - {{ lang.fido2.fido2_auth }}
-
-
{{ lang.fido2.known_ids }}:
-
-
- - - - - - {% include 'fido2.twig' %} -
ID{{ lang.admin.action }}
-
-
-
-
- -
-
-
- - - -
-
-
- -
-
{{ lang.fido2.register_status }}:
-
-
-
-
-
-
- - - {{ lang.admin.guid_and_license }} - -
-
-
-
- -
-
- - - - -
-

- {{ lang.admin.customer_id }}: {{ gal.c|default('?')|raw }} - - {{ lang.admin.service_id }}: {{ gal.s|default('?')|raw }} - - {{ lang.admin.sal_level }}: {{ gal.m|default('?')|raw }} -

-
-
-
-
-

{{ lang.admin.license_info|raw }}

-
- -
-
-
-
-
- - - API - -
-
+ + {{ lang.admin.guid_and_license }} + +
+
+
-
-

{{ lang.admin.api_info|raw }}

+ +
+
+ + + + +
+

+ {{ lang.admin.customer_id }}: {{ gal.c|default('?')|raw }} - + {{ lang.admin.service_id }}: {{ gal.s|default('?')|raw }} - + {{ lang.admin.sal_level }}: {{ gal.m|default('?')|raw }} +

-
-
-
-

{{ lang.admin.api_read_only }}

-
-
- -
- -
- -
-
-
-
- -
-
-
- -
- -
-
-
-
- -
-
-
-
-
- - -
-
-
- -
+
+
+
+

{{ lang.admin.license_info|raw }}

+
+
-
-
-
-

{{ lang.admin.api_read_write }}

-
-
-
-
- -
- +
+ +
+ + + API + +
+
+
+
+

{{ lang.admin.api_info|raw }}

+
+
+
+
+

{{ lang.admin.api_read_only }}

+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ +
-
-
- +
+ +
+
+
+
+
+
+

{{ lang.admin.api_read_write }}

+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ +
-
- -
- -
-
-
-
- -
-
-
-
-
- - -
-
-
- -
+
+
+
diff --git a/data/web/templates/debug.twig b/data/web/templates/debug.twig index 05b2761f..b4601094 100644 --- a/data/web/templates/debug.twig +++ b/data/web/templates/debug.twig @@ -7,20 +7,20 @@ {{ lang.debug.logs }}