admin.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. $(document).ready(function() {
  2. $.ajax({
  3. dataType: 'json',
  4. url: '/api/v1/domain-admin/all',
  5. jsonp: false,
  6. error: function () {
  7. alert('Cannot draw domain administrator table');
  8. },
  9. success: function (data) {
  10. $.each(data, function (i, item) {
  11. item.action = '<div class="btn-group">' +
  12. '<a href="/edit.php?domainadmin=' + encodeURI(item.username) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
  13. '<a href="/delete.php?domainadmin=' + encodeURI(item.username) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
  14. '</div>';
  15. });
  16. $('#domainadminstable').footable({
  17. "columns": [
  18. {"sorted": true,"name":"username","title":lang.username,"style":{"width":"250px"}},
  19. {"name":"selected_domains","title":lang.admin_domains,"breakpoints":"xs sm"},
  20. {"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"}},
  21. {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
  22. {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
  23. ],
  24. "rows": data,
  25. "empty": lang.empty,
  26. "paging": {
  27. "enabled": true,
  28. "limit": 5,
  29. "size": pagination_size
  30. },
  31. "filtering": {
  32. "enabled": true,
  33. "position": "left",
  34. "placeholder": lang.filter_table
  35. },
  36. "sorting": {
  37. "enabled": true
  38. }
  39. });
  40. }
  41. });
  42. });