Class: Avo::PaginatorComponent
Constant Summary
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary
collapse
#has_with_trial
#find_association_field
Instance Method Details
#change_items_per_page_url(option) ⇒ Object
13
14
15
16
17
18
19
|
# File 'app/components/avo/paginator_component.rb', line 13
def change_items_per_page_url(option)
if @parent_record.present?
helpers.related_resources_path(@parent_record, @parent_record, per_page: option, keep_query_params: true, page: 1)
else
helpers.resources_path(resource: @resource, per_page: option, keep_query_params: true, page: 1)
end
end
|
#pagy_major_version ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'app/components/avo/paginator_component.rb', line 43
def pagy_major_version
return nil unless defined?(Pagy::VERSION)
version = Pagy::VERSION&.split(".")&.first&.to_i
return "8-or-more" if version >= 8
version
end
|
#per_page_options ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/components/avo/paginator_component.rb', line 31
def per_page_options
@per_page_options ||= begin
options = [*Avo.configuration.per_page_steps, Avo.configuration.per_page.to_i, @index_params[:per_page].to_i]
if @parent_record.present?
options.prepend Avo.configuration.via_per_page
end
options.sort.uniq
end
end
|
#render? ⇒ Boolean
21
22
23
24
25
26
27
28
29
|
# File 'app/components/avo/paginator_component.rb', line 21
def render?
return false if @discreet_pagination && @pagy.pages <= 1
if ::Pagy::VERSION >= ::Gem::Version.new("9.0")
@pagy.limit > 0
else
@pagy.items > 0
end
end
|