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

[BS5] jquery datatable - add classes to action column

This commit is contained in:
FreddleSpl0it 2022-06-08 15:28:45 +02:00
parent 4ba0e155f3
commit df56d73cec
5 changed files with 58 additions and 29 deletions

View File

@ -194,6 +194,11 @@
.card-login .btn-group .btn { .card-login .btn-group .btn {
display: block !important; display: block !important;
} }
.dt-sm-head-hidden .dtr-title {
display: none !important;
}
} }
@media (max-width: 350px) { @media (max-width: 350px) {

View File

@ -118,9 +118,13 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ],
initComplete: function(settings, json){
console.log(settings.aoColumns);
}
}); });
} }
function draw_oauth2_clients() { function draw_oauth2_clients() {
@ -169,7 +173,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -224,7 +229,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -271,7 +277,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -326,7 +333,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -381,7 +389,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -447,7 +456,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -456,7 +466,7 @@ jQuery(function($){
function process_table_data(data, table) { function process_table_data(data, table) {
if (table == 'relayhoststable') { if (table == 'relayhoststable') {
$.each(data, function (i, item) { $.each(data, function (i, item) {
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="sender-dependent" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' + '<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="sender-dependent" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' +
'<a href="/edit/relayhost/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit/relayhost/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-rlyhost" data-api-url="delete/relayhost" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-rlyhost" data-api-url="delete/relayhost" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
@ -474,7 +484,7 @@ jQuery(function($){
if (item.username) { if (item.username) {
item.username = '<i style="color:#' + intToRGB(hashCode(item.nexthop)) + ';" class="bi bi-square-fill"></i> ' + item.username; item.username = '<i style="color:#' + intToRGB(hashCode(item.nexthop)) + ';" class="bi bi-square-fill"></i> ' + item.username;
} }
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="transport-map" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' + '<a href="#" data-bs-toggle="modal" data-bs-target="#testTransportModal" data-transport-id="' + encodeURI(item.id) + '" data-transport-type="transport-map" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-caret-right-fill"></i> Test</a>' +
'<a href="/edit/transport/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit/transport/' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-transport" data-api-url="delete/transport" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-transport" data-api-url="delete/transport" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
@ -488,20 +498,20 @@ jQuery(function($){
return escapeHtml(i); return escapeHtml(i);
}); });
item.recipients = rcpts.join('<hr style="margin:1px!important">'); item.recipients = rcpts.join('<hr style="margin:1px!important">');
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="#" data-bs-toggle="modal" data-bs-target="#showQueuedMsg" data-queue-id="' + encodeURI(item.queue_id) + '" class="btn btn-xs btn-secondary">' + lang.queue_show_message + '</a>' + '<a href="#" data-bs-toggle="modal" data-bs-target="#showQueuedMsg" data-queue-id="' + encodeURI(item.queue_id) + '" class="btn btn-xs btn-secondary">' + lang.queue_show_message + '</a>' +
'</div>'; '</div>';
}); });
} else if (table == 'forwardinghoststable') { } else if (table == 'forwardinghoststable') {
$.each(data, function (i, item) { $.each(data, function (i, item) {
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="#" data-action="delete_selected" data-id="single-fwdhost" data-api-url="delete/fwdhost" data-item="' + encodeURI(item.host) + '" class="btn btn-xs btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-fwdhost" data-api-url="delete/fwdhost" data-item="' + encodeURI(item.host) + '" class="btn btn-xs btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'</div>'; '</div>';
item.chkbox = '<input type="checkbox" data-id="fwdhosts" name="multi_select" value="' + item.host + '" />'; item.chkbox = '<input type="checkbox" data-id="fwdhosts" name="multi_select" value="' + item.host + '" />';
}); });
} else if (table == 'oauth2clientstable') { } else if (table == 'oauth2clientstable') {
$.each(data, function (i, item) { $.each(data, function (i, item) {
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="/edit.php?oauth2client=' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit.php?oauth2client=' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-oauth2-client" data-api-url="delete/oauth2-client" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-oauth2-client" data-api-url="delete/oauth2-client" data-item="' + encodeURI(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'</div>'; '</div>';
@ -514,7 +524,7 @@ jQuery(function($){
item.selected_domains = escapeHtml(item.selected_domains); item.selected_domains = escapeHtml(item.selected_domains);
item.selected_domains = item.selected_domains.toString().replace(/,/g, "<br>"); item.selected_domains = item.selected_domains.toString().replace(/,/g, "<br>");
item.chkbox = '<input type="checkbox" data-id="domain_admins" name="multi_select" value="' + item.username + '" />'; item.chkbox = '<input type="checkbox" data-id="domain_admins" name="multi_select" value="' + item.username + '" />';
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="/edit/domainadmin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit/domainadmin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-domain-admin" data-api-url="delete/domain-admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-domain-admin" data-api-url="delete/domain-admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-third btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'<a href="/index.php?duallogin=' + encodeURIComponent(item.username) + '" class="btn btn-xs btn-xs-third btn-success"><i class="bi bi-person-fill"></i> Login</a>' + '<a href="/index.php?duallogin=' + encodeURIComponent(item.username) + '" class="btn btn-xs btn-xs-third btn-success"><i class="bi bi-person-fill"></i> Login</a>' +
@ -528,7 +538,7 @@ jQuery(function($){
item.usr = item.username; item.usr = item.username;
} }
item.chkbox = '<input type="checkbox" data-id="admins" name="multi_select" value="' + item.username + '" />'; item.chkbox = '<input type="checkbox" data-id="admins" name="multi_select" value="' + item.username + '" />';
item.action = '<div class="btn-group footable-actions">' + item.action = '<div class="btn-group dataTables-actions">' +
'<a href="/edit/admin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' + '<a href="/edit/admin/' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-admin" data-api-url="delete/admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' + '<a href="#" data-action="delete_selected" data-id="single-admin" data-api-url="delete/admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'</div>'; '</div>';

View File

@ -350,7 +350,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -527,7 +528,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -605,7 +607,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -682,7 +685,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -748,7 +752,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -827,7 +832,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -940,7 +946,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -1016,7 +1023,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -1130,7 +1138,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });
@ -1204,7 +1213,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });

View File

@ -126,7 +126,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
}, },
] ]
}); });

View File

@ -184,7 +184,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
} }
] ]
}); });
@ -309,7 +310,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
} }
] ]
}); });
@ -387,7 +389,8 @@ jQuery(function($){
}, },
{ {
title: lang.action, title: lang.action,
data: 'action' data: 'action',
className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
} }
] ]
}); });