Module: Avo::Concerns::Pagination
- Extended by:
- ActiveSupport::Concern
- Included in:
- Resources::Base
- Defined in:
- lib/avo/concerns/pagination.rb
Instance Method Summary collapse
Instance Method Details
#apply_pagination(index_params:, query:, **args) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/avo/concerns/pagination.rb', line 30 def apply_pagination(index_params:, query:, **args) 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 data_turbo_frame = "data-turbo-frame=\"#{CGI.escapeHTML(params[:turbo_frame]) if params[:turbo_frame]}\"" send PAGINATION_METHOD[pagination_type.to_sym], query, **args, page: index_params[:page], items: index_params[:per_page], # Add per page in pagy < 9 limit: index_params[:per_page], # Add per page in pagy >= 9 link_extra: data_turbo_frame, # Add extra arguments in pagy 7. anchor_string: data_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 |