{% import 'ohmyadmin/ui/buttons.html' as buttons %} {% set header_cell_classes = 'px-6 py-3 border-b border-gray-200 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider' %} {% macro sortable_header_cell(request, field, sorting_helper) %} {% set current_ordering = sorting_helper.get_current_ordering(request, field.sort_by) %} {% set ordering_index = sorting_helper.get_current_ordering_index(request, field.sort_by) %} {% set next_ordering_url = sorting_helper.get_url(request, field.sort_by) %} {% set should_show_index = sorting_helper.should_show_index(request) %} {{ field.title }} {% if current_ordering == 'asc' %} {{ icon('arrow-narrow-down') }} {% elif current_ordering == 'desc' %} {{ icon('arrow-narrow-up') }} {% else %} {{ icon('arrows-sort') }} {% endif %} {% if should_show_index and ordering_index %} {{ ordering_index }} {% endif %} {% endmacro %} {% macro header_cell(request, field) %} {% if field.sortable %} {{ sortable_header_cell(request, field, sorting_helper) }} {% else %} {{ field.title }} {% endif %} {% endmacro %} {% macro cell(request, column, obj) %} {{ column(request, obj) }} {% endmacro %} {% macro destroy_object_button(object, confirmation) %}
{{ buttons.icon_button('trash', 'danger') }}
{% endmacro %} {% for field in fields %} {% endfor %} {% for object in page %} {% for field in fields %} {% endfor %} {% endfor %}
{{ header_cell(request, field) }}
{% if field.link %} {% endif %} {% with value = field.get_display_value(object) %} {% include field.cell_template %} {% endwith %} {% if field.link %} {% endif %} {{ buttons.link_icon_button(edit_object_url(object), 'pencil') }} {{ destroy_object_button(object, 'Delete?') }}