table.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {% assign roles = 'User,Admin,Owner' | split: ',' %}
  2. {% assign limit = include.limit | default: 5 %}
  3. <div class="table-responsive">
  4. <table
  5. class="table table-vcenter{% if include.mobile %} table-mobile-md{% endif %}{% if include.card %} card-table{% endif %}{% if include.stripped %} table-striped{% endif %}{% if include.nowrap %} table-nowrap{% endif %}">
  6. <thead>
  7. <tr>
  8. <th>Name</th>
  9. <th>Title</th>
  10. {% unless include.avatars %}
  11. <th>Email</th>
  12. {% endunless %}
  13. <th>Role</th>
  14. {% if include.nowrap %}
  15. <th></th>
  16. {% endif %}
  17. <th class="w-1"></th>
  18. </tr>
  19. </thead>
  20. <tbody>
  21. {% for person in site.data.people limit: limit offset: include.offset %}
  22. <tr>
  23. {% if include.avatars %}
  24. <td {% if include.mobile %}data-label="Name" {% endif %}>
  25. <div class="d-flex py-1 align-items-center">
  26. {% include "ui/avatar.html" person-id=person.id class="me-2" %}
  27. <div class="flex-fill">
  28. <div class="font-weight-medium">{{ person.full_name }}</div>
  29. <div class="text-secondary"><a href="#" class="text-reset">{{ person.email }}</a></div>
  30. </div>
  31. </div>
  32. </td>
  33. {% else %}
  34. <td {% if include.mobile %}data-label="Name" {% endif %}>{{ person.full_name }}</td>
  35. {% endif %}
  36. {% if include.avatars %}
  37. <td {% if include.mobile %}data-label="Title" {% endif %}>
  38. <div>{{ person.job_title }}</div>
  39. <div class="text-secondary">{{ person.department }}</div>
  40. </td>
  41. {% else %}
  42. <td class="text-secondary" {% if include.mobile %}data-label="Title" {% endif %}>
  43. {{ person.job_title }}, {{ person.department }}
  44. </td>
  45. {% endif %}
  46. {% unless include.avatars %}
  47. <td class="text-secondary" {% if include.mobile %}data-label="Email" {% endif %}><a href="#" class="text-reset">{{
  48. person.email }}</a></td>
  49. {% endunless %}
  50. <td class="text-secondary" {% if include.mobile %}data-label="Role" {% endif %}>
  51. {% assign role-id = forloop.index | random_number: 0, 2 %}
  52. {{ roles[role-id] }}
  53. </td>
  54. {% if include.nowrap %}
  55. <td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi, commodi cupiditate debitis deserunt
  56. expedita hic incidunt iste modi molestiae nesciunt non nostrum perferendis perspiciatis placeat praesentium
  57. quaerat quo repellendus, voluptates.
  58. </td>
  59. {% endif %}
  60. <td>
  61. {% if include.buttons %}
  62. <div class="btn-list flex-nowrap">
  63. {% include "ui/button.html" text="Edit" %}
  64. <div class="dropdown">
  65. <button class="btn dropdown-toggle align-text-top" data-bs-toggle="dropdown">
  66. Actions
  67. </button>
  68. {% include "ui/dropdown-menu.html" right=true %}
  69. </div>
  70. </div>
  71. {% else %}
  72. <a href="#">Edit</a>
  73. {% endif %}
  74. </td>
  75. </tr>
  76. {% endfor %}
  77. </tbody>
  78. </table>
  79. </div>