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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix[Op#57989]: allow pagination links to cofigure nagivation visit via `data-turbo-action`
Kabiru Mwenjaf7f4bff93673
diff --git a/app/components/admin/custom_fields/custom_field_projects/table_component.rb b/app/components/admin/custom_fields/custom_field_projects/table_component.rbindex 9ef7650dab1..970301255d1 100644--- a/app/components/admin/custom_fields/custom_field_projects/table_component.rb+++ b/app/components/admin/custom_fields/custom_field_projects/table_component.rb@@ -52,9 +52,10 @@ module Admin# the controller action that link_to should use.#def optional_pagination_options- return super unless params[:url_for_action]-- super.merge(params: { action: params[:url_for_action] })+ super.tap do |options|+ options[:params] = { action: params[:url_for_action] } if params[:url_for_action]+ options[:turbo_action] = "advance"+ endendendenddiff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rbindex c8a53aaadc4..81bf2516eb3 100644--- a/app/helpers/pagination_helper.rb+++ b/app/helpers/pagination_helper.rb@@ -202,6 +202,7 @@ module PaginationHelperdef link(text, target, attributes)new_attributes = attributes.dupnew_attributes["data-turbo-stream"] = true if turbo?+ new_attributes["data-turbo-action"] = turbo_action if turbo_action.present?super(text, target, new_attributes)end@@ -210,6 +211,14 @@ module PaginationHelper@options[:allowed_params] # rubocop:disable Rails/HelperInstanceVariableend+ # Customize the Turbo visit action for pagination links. Can be set to "advance" or "replace".+ # "advance" - push a new entry onto the history stack.+ # "replace" - replace the current history entry.+ # See: https://turbo.hotwired.dev/reference/attributes+ def turbo_action+ @options[:turbo_action] # rubocop:disable Rails/HelperInstanceVariable+ end+def turbo?@options[:turbo] # rubocop:disable Rails/HelperInstanceVariableend