Module: Avo::Concerns::Pagination
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseResource
- Defined in:
- lib/avo/concerns/pagination.rb
Instance Method Summary collapse
Instance Method Details
#apply_pagination(index_params:, query:) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/avo/concerns/pagination.rb', line 30 def apply_pagination(index_params:, query:) extra_pagy_params = {} # Reset open filters when a user navigates to a new page if params[:keep_filters_panel_open] == "1" extra_pagy_params[:keep_filters_panel_open] = "0" end send PAGINATION_METHOD[pagination_type.to_sym], query, items: index_params[:per_page], link_extra: "data-turbo-frame=\"#{params[:turbo_frame]}\"", # Add extra arguments in pagy 7. anchor_string: "data-turbo-frame=\"#{params[:turbo_frame]}\"", # Add extra arguments in pagy 8. params: extra_pagy_params, size: pagination_hash[:size] end |
#pagination_type ⇒ Object
26 27 28 |
# File 'lib/avo/concerns/pagination.rb', line 26 def pagination_type @pagination_type ||= ActiveSupport::StringInquirer.new(pagination_hash[:type].to_s) end |