Bladeren bron

[BS5] jquery datatable - add classes to action column

FreddleSpl0it 3 jaren geleden
bovenliggende
commit
df56d73cec

+ 5 - 0
data/web/css/build/014-responsive.css

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

+ 25 - 15
data/web/js/site/admin.js

@@ -118,9 +118,13 @@ jQuery(function($){
           },
           {
             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() {
@@ -169,7 +173,8 @@ jQuery(function($){
           },
           {
             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,
-            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,
-            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,
-            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,
-            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,
-            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) {
     if (table == 'relayhoststable') {
       $.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="/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>' +
@@ -474,7 +484,7 @@ jQuery(function($){
         if (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="/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>' +
@@ -488,20 +498,20 @@ jQuery(function($){
           return escapeHtml(i);
         });
         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>' +
           '</div>';
       });
     } else if (table == 'forwardinghoststable') {
       $.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>' +
           '</div>';
         item.chkbox = '<input type="checkbox" data-id="fwdhosts" name="multi_select" value="' + item.host + '" />';
       });
     } else if (table == 'oauth2clientstable') {
       $.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="#" 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>';
@@ -514,7 +524,7 @@ jQuery(function($){
         item.selected_domains = escapeHtml(item.selected_domains);
         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.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="#" 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>' +
@@ -528,7 +538,7 @@ jQuery(function($){
           item.usr = 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="#" 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>';

+ 20 - 10
data/web/js/site/mailbox.js

@@ -350,7 +350,8 @@ jQuery(function($){
         },
         {
           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,
-            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,
-            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,
-            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,
-            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,
-            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,
-            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,
-            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,
-            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,
-            data: 'action'
+            data: 'action',
+            className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
           },
       ]
     });

+ 2 - 1
data/web/js/site/quarantine.js

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

+ 6 - 3
data/web/js/site/user.js

@@ -184,7 +184,8 @@ jQuery(function($){
         },
         {
           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,
-          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,
-          data: 'action'
+          data: 'action',
+          className: 'text-md-end d-md-block dt-sm-head-hidden dt-body-right'
         }
       ]
     });