<% table_class = @has_position ? 'js-sort-row' : 'js-sort-column' -%> <% num_columns = 3 -%>

render 'fae/shared/index_header', title: @klass_humanized.pluralize.titleize

main.content

table.<%= table_class %>
  thead
    tr

<% if @has_position -%>

th.th-sortable-handle

<% num_columns += 1 -%> <% end -%>

th <%= @display_field.present? ? @display_field.titleize : 'Name' %>
th.-action-wide Modified

<% @toggle_attrs.each do |attr| -%>

th.-action-wide data-sorter="false" <%= attr.titleize %>

<% num_columns += 1 -%> <% end -%>

    th.-action data-sorter="false"

tbody
  - if @items.present?
    - @items.each do |item|
      tr id=fae_sort_id(item)

<% if @has_position -%>

td.sortable-handle: i.icon-sort

<% end -%>

td = link_to item.fae_display_field, edit_<%= options.namespace %>_<%= class_name.underscore %>_path(item)
td = fae_date_format item.updated_at

<% @toggle_attrs.each do |attr| -%>

td = fae_toggle item, :<%= attr %>

<% end -%>

      td = fae_delete_button item
- else
  tr: td colspan="<%= num_columns %>" No items found