Sha256: 99b099e96564806bcffc3a0ab414d6cc1dae727c1789b64ea354228eda29c9d3

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

<thead class="bg-white border-b border-gray-200 pb-1">
  <th class="rounded-lg">
    <%== item_select_all_input %>
  </th>
  <%
    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-sm font-semibold"
  %>
    <th class="text-left uppercase px-3 py-4 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">
    <!-- Controls cell -->
  </th>
</thead>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avo-2.1.2.pre2 app/views/avo/partials/_table_header.html.erb
avo-2.1.2.pre1 app/views/avo/partials/_table_header.html.erb
avo-2.1.1 app/views/avo/partials/_table_header.html.erb
avo-2.1.0 app/views/avo/partials/_table_header.html.erb
avo-2.0.0 app/views/avo/partials/_table_header.html.erb