Sha256: 83b40a0dee8e929a7f6b71e3c7a0c10a357d0fffeda4f831d3ccea8858ea4c61

Contents?: true

Size: 1.46 KB

Versions: 84

Compression:

Stored size: 1.46 KB

Contents

<thead class="bg-blue-gray-100 border-t border-b border-gray-300 pb-1">
  <th>
    <!-- Select cell -->
  </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-blue-gray-600 tracking-tight leading-tight text-xs font-semibold"
  %>
    <th class="text-left uppercase px-3 py-2 whitespace-nowrap">
      <% 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

84 entries across 84 versions & 1 rubygems

Version Path
avo-1.11.4 app/views/avo/partials/_table_header.html.erb
avo-1.11.3 app/views/avo/partials/_table_header.html.erb
avo-1.11.2 app/views/avo/partials/_table_header.html.erb
avo-1.11.1 app/views/avo/partials/_table_header.html.erb
avo-1.10.3 app/views/avo/partials/_table_header.html.erb
avo-1.11.0 app/views/avo/partials/_table_header.html.erb
avo-1.10.2 app/views/avo/partials/_table_header.html.erb
avo-1.10.1 app/views/avo/partials/_table_header.html.erb
avo-1.10.0 app/views/avo/partials/_table_header.html.erb
avo-1.9.1 app/views/avo/partials/_table_header.html.erb
avo-1.9.0 app/views/avo/partials/_table_header.html.erb
avo-1.8.4 app/views/avo/partials/_table_header.html.erb
avo-1.8.3 app/views/avo/partials/_table_header.html.erb
avo-1.8.2 app/views/avo/partials/_table_header.html.erb
avo-1.8.1 app/views/avo/partials/_table_header.html.erb
avo-1.8.0 app/views/avo/partials/_table_header.html.erb
avo-1.7.3 app/views/avo/partials/_table_header.html.erb
avo-1.7.3.pre.1 app/views/avo/partials/_table_header.html.erb
avo-1.7.2 app/views/avo/partials/_table_header.html.erb
avo-1.7.1 app/views/avo/partials/_table_header.html.erb