chore(manager): disable pagination count on massive tables

This commit is contained in:
Colin Darie 2022-11-15 12:21:20 +01:00
parent a28e31bd97
commit a4ed1d07af
3 changed files with 14 additions and 0 deletions

View file

@ -21,5 +21,9 @@ module Manager
def unfiltered_list?
action_name == "index" && !params[:search]
end
def paginate_resources(_resources)
super.without_count
end
end
end

View file

@ -89,5 +89,9 @@ module Manager
def targeted_email
params[:user][:email]
end
def paginate_resources(_resources)
super.without_count
end
end
end

View file

@ -0,0 +1,6 @@
- if resources.singleton_class.included_modules.include?(Kaminari::PaginatableWithoutCount)
%nav.pagination
= link_to_prev_page resources, t("views.pagination.previous"), param_name: "_page"
= link_to_next_page resources, t("views.pagination.next"), param_name: "_page"
- else
= paginate resources, param_name: "_page"