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
Use turbo stream when sorting columns
Klaus Zanders5a8925c33732
diff --git a/app/components/projects/table_component.html.erb b/app/components/projects/table_component.html.erbindex aba75fdcdeb..b2f2f2046bd 100644--- a/app/components/projects/table_component.html.erb+++ b/app/components/projects/table_component.html.erb@@ -50,13 +50,13 @@ See COPYRIGHT and LICENSE files for more details.helpers.op_icon("icon-hierarchy"),href: href_only_when_not_sort_lft,class: "spot-link #{deactivate_class_on_lft_sort}",+ data: { "turbo-stream": true },title: t(:label_sort_by, value: %("#{t(:label_project_hierarchy)}")) %></div></div></th><% elsif sortable_column?(column) %>- <%= build_sort_header column.attribute,- order_options(column) %>+ <%= build_sort_header column.attribute, order_options(column, turbo: true) %><% elsif column.attribute == :favored %><th><div class="generic-table--header-outer">diff --git a/app/components/projects/table_component.rb b/app/components/projects/table_component.rbindex 76d9ef5dea0..0873cb7ad70 100644--- a/app/components/projects/table_component.rb+++ b/app/components/projects/table_component.rb@@ -115,10 +115,14 @@ module Projectsendend- def order_options(select)- {- caption: select.caption- }+ def order_options(select, turbo: false)+ options = { caption: select.caption }++ if turbo+ options[:data] = { "turbo-stream": true }+ end++ optionsenddef sortable_column?(select)diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rbindex 96ec6b1048b..3de566be89c 100644--- a/spec/helpers/sort_helper_spec.rb+++ b/spec/helpers/sort_helper_spec.rb@@ -250,7 +250,17 @@ RSpec.describe SortHelper doit "includes the passed data parm in the link" doexpect(output).to be_html_eql(<<~HTML)- <th title="Sort by "Id""><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span><a title="Sort by "Id"" data-turbo-stream="true" href="/work_packages?sort=sort_criteria_params">Id</a></span></div></div></th>+ <th title="Sort by "Id"">+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <a title="Sort by "Id"" data-turbo-stream="true" href="/work_packages?sort=sort_criteria_params">+ Id+ </a>+ </span>+ </div>+ </div>+ </th>HTMLendend