1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-04 10:24:42 +02:00

[BS5] remember last nav pill fix

This commit is contained in:
FreddleSpl0it 2022-06-07 15:28:28 +02:00
parent cb6a5d4069
commit cdd2adbc73
4 changed files with 243 additions and 224 deletions

View File

@ -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) {

View File

@ -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

View File

@ -1,7 +1,7 @@
<div role="tabpanel" class="tab-pane fade show active" id="tab-config-admins" role="tabpanel" aria-labelledby="tab-config-admins">
<div class="card mb-4">
<div class="card-header bg-danger text-white d-flex">
<button class="btn d-md-none text-white flex-grow-1 text-start" data-bs-target="#collapse-tab-config-admins" data-bs-toggle="collapse" aria-controls="ollapse-tab-config-admins">
<button class="btn d-md-none text-white flex-grow-1 text-start" data-bs-target="#collapse-tab-config-admins" data-bs-toggle="collapse" aria-controls="collapse-tab-config-admins">
{{ lang.admin.admin_details }}
</button>
<span class="d-none d-md-block">{{ lang.admin.admin_details }}</span>

View File

@ -7,20 +7,20 @@
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.debug.logs }}</a>
<ul class="dropdown-menu">
<li role="presentation"><span class="dropdown-header fs-6">{{ lang.debug.in_memory_logs }}</span></li>
<li role="presentation"><a class="dropdown-item" href="#tab-postfix-logs" aria-controls="tab-postfix-logs" role="tab" data-bs-toggle="tab">Postfix</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-dovecot-logs" aria-controls="tab-dovecot-logs" role="tab" data-bs-toggle="tab">Dovecot</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-sogo-logs" aria-controls="tab-sogo-logs" role="tab" data-bs-toggle="tab">SOGo</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-netfilter-logs" aria-controls="tab-netfilter-logs" role="tab" data-bs-toggle="tab">Netfilter</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-autodiscover-logs" aria-controls="tab-autodiscover-logs" role="tab" data-bs-toggle="tab">Autodiscover</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-watchdog-logs" aria-controls="tab-watchdog-logs" role="tab" data-bs-toggle="tab">Watchdog</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-acme-logs" aria-controls="tab-acme-logs" role="tab" data-bs-toggle="tab">ACME</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-api-logs" aria-controls="tab-api-logs" role="tab" data-bs-toggle="tab">API</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-api-rl" aria-controls="tab-api-rl" role="tab" data-bs-toggle="tab">Ratelimits</a></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-postfix-logs" aria-selected="false" aria-controls="tab-postfix-logs" role="tab" data-bs-toggle="tab">Postfix</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-dovecot-logs" aria-selected="false" aria-controls="tab-dovecot-logs" role="tab" data-bs-toggle="tab">Dovecot</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-sogo-logs" aria-selected="false" aria-controls="tab-sogo-logs" role="tab" data-bs-toggle="tab">SOGo</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-netfilter-logs" aria-selected="false" aria-controls="tab-netfilter-logs" role="tab" data-bs-toggle="tab">Netfilter</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-autodiscover-logs" aria-selected="false" aria-controls="tab-autodiscover-logs" role="tab" data-bs-toggle="tab">Autodiscover</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-watchdog-logs" aria-selected="false" aria-controls="tab-watchdog-logs" role="tab" data-bs-toggle="tab">Watchdog</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-acme-logs" aria-selected="false" aria-controls="tab-acme-logs" role="tab" data-bs-toggle="tab">ACME</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-api-logs" aria-selected="false" aria-controls="tab-api-logs" role="tab" data-bs-toggle="tab">API</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-api-rl" aria-selected="false" aria-controls="tab-api-rl" role="tab" data-bs-toggle="tab">Ratelimits</button></li>
<li role="presentation"><span class="dropdown-header fs-6">{{ lang.debug.external_logs }}</span></li>
<li role="presentation"><a class="dropdown-item" href="#tab-rspamd-history" aria-controls="tab-rspamd-history" role="tab" data-bs-toggle="tab">Rspamd</a></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-rspamd-history" aria-selected="false" aria-controls="tab-rspamd-history" role="tab" data-bs-toggle="tab">Rspamd</button></li>
<li role="presentation"><span class="dropdown-header fs-6">{{ lang.debug.static_logs }}</span></li>
<li role="presentation"><a class="dropdown-item" href="#tab-ui" aria-controls="tab-ui" role="tab" data-bs-toggle="tab">Mailcow UI</a></li>
<li role="presentation"><a class="dropdown-item" href="#tab-sasl" aria-controls="tab-sasl" role="tab" data-bs-toggle="tab">SASL</a></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-ui" aria-selected="false" aria-controls="tab-ui" role="tab" data-bs-toggle="tab">Mailcow UI</button></li>
<li role="presentation"><button class="dropdown-item" data-bs-target="#tab-sasl" aria-selected="false" aria-controls="tab-sasl" role="tab" data-bs-toggle="tab">SASL</button></li>
</ul>
</li>
</ul>