<% per_page_options = [*Avo.configuration.per_page_steps, Avo.configuration.per_page.to_i, index_params[:per_page].to_i] if parent_resource.present? per_page_options.prepend Avo.configuration.via_per_page end per_page_options = per_page_options.sort.uniq %>
<%= select_tag 'per_page', options_for_select(per_page_options, index_params[:per_page]), class: 'appearance-none inline-flex bg-white-100 disabled:bg-white-400 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-600 rounded-md py-1 px-2 leading-tight border border-slate-300 outline-none focus:border-slate-400 outline w-16 mr-1 text-sm', data: { 'turbo-frame': turbo_frame, 'per-page-target': 'selector', action: 'change->per-page#reload' } %> <%= t('avo.per_page').downcase %>
<% per_page_options.each do |option| %> <% if parent_resource.present? %> <%= link_to "Change to #{option} items per page", helpers.related_resources_path(parent_resource.model_class, resource.model_class, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %> <% else %> <%= link_to "Change to #{option} items per page", helpers.resources_path(resource: resource, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %> <% end %> <% end %>
<% if @pagy.count > 0 %>
<%== helpers.pagy_info @pagy %>
<% end %> <% if @pagy.pages > 1 %> <%# @todo: add first & last page. make the first and last buttons rounded %> <%== helpers.pagy_nav @pagy %> <% end %>