Merge pull request #5186 from goodygh/datatables_sorting

[Web] Datatables sorting
This commit is contained in:
Patrick Schult 2023-04-20 13:50:57 +02:00 committed by GitHub
commit ed076dc23e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 37 deletions

View File

@ -342,6 +342,10 @@ div.dataTables_wrapper div.dt-row {
position: relative; position: relative;
} }
div.dataTables_wrapper span.sorting-value {
display: none;
}
div.dataTables_scrollHead table.dataTable { div.dataTables_scrollHead table.dataTable {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }

View File

@ -117,8 +117,8 @@ jQuery(function($){
data: 'tfa_active', data: 'tfa_active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -126,8 +126,8 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -260,8 +260,8 @@ jQuery(function($){
data: 'tfa_active', data: 'tfa_active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -269,8 +269,8 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -337,7 +337,7 @@ jQuery(function($){
data: 'keep_spam', data: 'keep_spam',
defaultContent: '', defaultContent: '',
render: function(data, type){ render: function(data, type){
return 'yes'==data?'<i class="bi bi-x-lg"></i>':'no'==data&&'<i class="bi bi-check-lg"></i>'; return 'yes'==data?'<i class="bi bi-x-lg"><span class="sorting-value">yes</span></i>':'no'==data&&'<i class="bi bi-check-lg"><span class="sorting-value">no</span></i>';
} }
}, },
{ {
@ -414,8 +414,8 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -492,8 +492,8 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
if(data == 1) return '<i class="bi bi-check-lg"></i>'; if(data == 1) return '<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>';
else return '<i class="bi bi-x-lg"></i>'; else return '<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {

View File

@ -607,7 +607,7 @@ jQuery(function($){
defaultContent: '', defaultContent: '',
responsivePriority: 6, responsivePriority: 6,
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':(0==data?'<i class="bi bi-x-lg"></i>':2==data&&'&#8212;'); return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':(0==data?'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>':2==data&&'&#8212;');
} }
}, },
{ {
@ -754,7 +754,7 @@ jQuery(function($){
data: 'attributes.gal', data: 'attributes.gal',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -762,7 +762,7 @@ jQuery(function($){
data: 'attributes.backupmx', data: 'attributes.backupmx',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -770,7 +770,7 @@ jQuery(function($){
data: 'attributes.relay_all_recipients', data: 'attributes.relay_all_recipients',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -778,7 +778,7 @@ jQuery(function($){
data: 'attributes.relay_unknown_only', data: 'attributes.relay_unknown_only',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -787,7 +787,7 @@ jQuery(function($){
defaultContent: '', defaultContent: '',
responsivePriority: 4, responsivePriority: 4,
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -1093,7 +1093,7 @@ jQuery(function($){
defaultContent: '', defaultContent: '',
responsivePriority: 4, responsivePriority: 4,
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':(0==data?'<i class="bi bi-x-lg"></i>':2==data&&'&#8212;'); return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':(0==data?'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>':2==data&&'&#8212;');
} }
}, },
{ {
@ -1164,13 +1164,13 @@ jQuery(function($){
item.attributes.quota = humanFileSize(item.attributes.quota); item.attributes.quota = humanFileSize(item.attributes.quota);
item.attributes.tls_enforce_in = '<i class="text-' + (item.attributes.tls_enforce_in == 1 ? 'success bi bi-lock-fill' : 'danger bi bi-unlock-fill') + '"></i>'; item.attributes.tls_enforce_in = '<i class="text-' + (item.attributes.tls_enforce_in == 1 ? 'success bi bi-lock-fill' : 'danger bi bi-unlock-fill') + '"><span class="sorting-value">' + (item.attributes.tls_enforce_in == 1 ? '1' : '0') + '</span></i>';
item.attributes.tls_enforce_out = '<i class="text-' + (item.attributes.tls_enforce_out == 1 ? 'success bi bi-lock-fill' : 'danger bi bi-unlock-fill') + '"></i>'; item.attributes.tls_enforce_out = '<i class="text-' + (item.attributes.tls_enforce_out == 1 ? 'success bi bi-lock-fill' : 'danger bi bi-unlock-fill') + '"><span class="sorting-value">' + (item.attributes.tls_enforce_out == 1 ? '1' : '0') + '</span></i>';
item.attributes.pop3_access = '<i class="text-' + (item.attributes.pop3_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.pop3_access == 1 ? 'check-lg' : 'x-lg') + '"></i>'; item.attributes.pop3_access = '<i class="text-' + (item.attributes.pop3_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.pop3_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.pop3_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.imap_access = '<i class="text-' + (item.attributes.imap_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.imap_access == 1 ? 'check-lg' : 'x-lg') + '"></i>'; item.attributes.imap_access = '<i class="text-' + (item.attributes.imap_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.imap_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.imap_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.smtp_access = '<i class="text-' + (item.attributes.smtp_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.smtp_access == 1 ? 'check-lg' : 'x-lg') + '"></i>'; item.attributes.smtp_access = '<i class="text-' + (item.attributes.smtp_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.smtp_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.smtp_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.sieve_access = '<i class="text-' + (item.attributes.sieve_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.sieve_access == 1 ? 'check-lg' : 'x-lg') + '"></i>'; item.attributes.sieve_access = '<i class="text-' + (item.attributes.sieve_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.sieve_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.sieve_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.sogo_access = '<i class="text-' + (item.attributes.sogo_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.sogo_access == 1 ? 'check-lg' : 'x-lg') + '"></i>'; item.attributes.sogo_access = '<i class="text-' + (item.attributes.sogo_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.sogo_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.sogo_access == 1 ? '1' : '0') + '</span></i>';
if (item.attributes.quarantine_notification === 'never') { if (item.attributes.quarantine_notification === 'never') {
item.attributes.quarantine_notification = lang.never; item.attributes.quarantine_notification = lang.never;
} else if (item.attributes.quarantine_notification === 'hourly') { } else if (item.attributes.quarantine_notification === 'hourly') {
@ -1188,7 +1188,6 @@ jQuery(function($){
item.attributes.quarantine_category = lang.q_all; item.attributes.quarantine_category = lang.q_all;
} }
if (item.template.toLowerCase() == "default"){ if (item.template.toLowerCase() == "default"){
item.action = '<div class="btn-group">' + item.action = '<div class="btn-group">' +
'<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
@ -1329,7 +1328,7 @@ jQuery(function($){
defaultContent: '', defaultContent: '',
responsivePriority: 4, responsivePriority: 4,
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':(0==data?'<i class="bi bi-x-lg"></i>':2==data&&'&#8212;'); return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':(0==data?'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>':2==data&&'&#8212;');
} }
}, },
{ {
@ -1440,7 +1439,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':(0==data?'<i class="bi bi-x-lg"></i>':2==data&&'&#8212;'); return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':(0==data?'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>':2==data&&'&#8212;');
} }
}, },
{ {
@ -1578,7 +1577,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':(0==data?'<i class="bi bi-x-lg"></i>':2==data&&'&#8212;'); return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':(0==data?'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>':2==data&&'&#8212;');
} }
}, },
{ {
@ -1675,7 +1674,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -1782,7 +1781,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -1917,7 +1916,7 @@ jQuery(function($){
data: 'sogo_visible', data: 'sogo_visible',
defaultContent: '', defaultContent: '',
render: function(data, type){ render: function(data, type){
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -1936,7 +1935,7 @@ jQuery(function($){
defaultContent: '', defaultContent: '',
responsivePriority: 6, responsivePriority: 6,
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -2035,7 +2034,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {
@ -2171,7 +2170,7 @@ jQuery(function($){
data: 'active', data: 'active',
defaultContent: '', defaultContent: '',
render: function (data, type) { render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'; return 1==data?'<i class="bi bi-check-lg"><span class="sorting-value">1</span></i>':0==data&&'<i class="bi bi-x-lg"><span class="sorting-value">0</span></i>';
} }
}, },
{ {