Sha256: 06efa337170d16cecf4b507561f05321384a0c440ee78570f7810641cf3fa707

Contents?: true

Size: 1.53 KB

Versions: 8

Compression:

Stored size: 1.53 KB

Contents

<thead class="bg-white border-b border-gray-200 pb-1">
  <% if @resource.record_selector %>
    <th class="rounded-lg">
      <%== item_select_all_input %>
    </th>
  <% end %>
  <% fields.each_with_index do |field, index|  %>
    <%
      if params[:sort_by] == field.id.to_s
        if params[:sort_direction] == 'asc'
          sort_by = nil
        else
          sort_by = field.id
        end

        if sort_by.present?
          case params[:sort_direction]
            when nil
              sort_direction = 'desc'
            when 'desc'
              sort_direction = 'asc'
            when 'asc'
              sort_direction = nil
            end
        else
          sort_direction = nil
        end
      else
        sort_by = field.id
        sort_direction = 'desc'
      end
      classes = "text-gray-500 tracking-tight leading-tight text-xs font-semibold"
    %>
    <th class="text-left uppercase px-3 py-2 whitespace-nowrap rounded-l">
      <% if field.sortable %>
        <%= link_to params.permit!.merge(sort_by: sort_by, sort_direction: sort_direction), class: "flex items-center #{classes} #{'cursor-pointer' if field.sortable}", 'data-turbo-frame': params[:turbo_frame] do %>
          <%= field.name %>
          <%= render partial: 'avo/partials/sortable_component', locals: {field: field} %>
        <% end %>
      <% else %>
        <div class="flex items-center <%= classes %>">
          <%= field.name %>
        </div>
      <% end %>
    </th>
  <% end %>
  <th class="w-24">
    <!-- Item controls cell -->
  </th>
</thead>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
avo-2.8.0 app/views/avo/partials/_table_header.html.erb
avo-2.7.1.pre.1 app/views/avo/partials/_table_header.html.erb
avo-2.7.0 app/views/avo/partials/_table_header.html.erb
avo-2.6.1.pre.2 app/views/avo/partials/_table_header.html.erb
avo-2.6.1.pre.1 app/views/avo/partials/_table_header.html.erb
avo-2.6.0 app/views/avo/partials/_table_header.html.erb
avo-2.5.2.pre.6 app/views/avo/partials/_table_header.html.erb
avo-2.5.2.pre.5 app/views/avo/partials/_table_header.html.erb