Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

feat[#55504] Allow pagination options to be passed in Projects::TableComponent

Kabiru Mwenja5d296a12bea7
diff --git a/app/components/projects/table_component.html.erb b/app/components/projects/table_component.html.erb
index 9746443263a..ad70487606f 100644
--- a/app/components/projects/table_component.html.erb
+++ b/app/components/projects/table_component.html.erb
@@ -104,5 +104,5 @@ See COPYRIGHT and LICENSE files for more details.
</div>
<% if paginated? %>
- <%= helpers.pagination_links_full model, allowed_params: %i[query_id filters columns sortBy] %>
+ <%= helpers.pagination_links_full model, pagination_options %>
<% end %>
diff --git a/app/components/projects/table_component.rb b/app/components/projects/table_component.rb
index 333ed109aed..8828376130c 100644
--- a/app/components/projects/table_component.rb
+++ b/app/components/projects/table_component.rb
@@ -34,8 +34,8 @@ module Projects
options :current_user # adds this option to those of the base class
options :query
- def initialize(**options)
- super(rows: [], **options)
+ def initialize(**)
+ super(rows: [], **)
end
def before_render
@@ -82,6 +82,18 @@ module Projects
true
end
+ def pagination_options
+ default_pagination_options.merge(optional_pagination_options)
+ end
+
+ def default_pagination_options
+ { allowed_params: %i[query_id filters columns sortBy] }
+ end
+
+ def optional_pagination_options
+ {}
+ end
+
def deactivate_class_on_lft_sort
if sorted_by_lft?
"spot-link_inactive"