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
have project list export modal be loaded asynchronously
ulferts570478e31bf7
diff --git a/app/components/projects/export_list_modal_component.rb b/app/components/projects/export_list_modal_component.rbindex fa9099bb47b..28085a486ff 100644--- a/app/components/projects/export_list_modal_component.rb+++ b/app/components/projects/export_list_modal_component.rb@@ -28,7 +28,8 @@# See COPYRIGHT and LICENSE files for more details.# ++-class Projects::ExportListModalComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent+class Projects::ExportListModalComponent < ApplicationComponent+ include OpTurbo::StreamableMODAL_ID = "op-project-list-export-dialog"options :querydiff --git a/app/components/projects/index_page_header_component.html.erb b/app/components/projects/index_page_header_component.html.erbindex 997a23469b0..9c5d8140a0d 100644--- a/app/components/projects/index_page_header_component.html.erb+++ b/app/components/projects/index_page_header_component.html.erb@@ -122,8 +122,10 @@endmenu.with_item(+ tag: :a,label: t('js.label_export'),- content_arguments: { 'data-show-dialog-id': Projects::ExportListModalComponent::MODAL_ID }+ href: export_list_modal_projects_path(projects_query_params),+ content_arguments: { data: { controller: "async-dialog" } }) do |item|item.with_leading_visual_icon(icon: 'sign-out')end@@ -151,5 +153,4 @@<% if show_state? %><%= render(Projects::ConfigureViewModalComponent.new(query:)) %><%= render(Projects::DeleteListModalComponent.new(query:)) if query.persisted? %>- <%= render(Projects::ExportListModalComponent.new(query:)) %><% end %>diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rbindex 82223e5406b..9a953ba2973 100644--- a/app/controllers/projects_controller.rb+++ b/app/controllers/projects_controller.rb@@ -30,19 +30,20 @@ class ProjectsController < ApplicationControllermenu_item :overviewmenu_item :roadmap, only: :roadmap- before_action :find_project, except: %i[index new]- before_action :load_query_or_deny_access, only: %i[index]+ before_action :find_project, except: %i[index new export_list_modal]+ before_action :load_query_or_deny_access, only: %i[index export_list_modal]before_action :authorize, only: %i[copy deactivate_work_package_attachments]before_action :authorize_global, only: %i[new]before_action :require_admin, only: %i[destroy destroy_info]- no_authorization_required! :index+ no_authorization_required! :index, :export_list_modalinclude SortHelperinclude PaginationHelperinclude QueriesHelperinclude ProjectsHelperinclude Projects::QueryLoading+ include OpTurbo::DialogStreamHelperhelper_method :has_managed_project_folders?@@ -105,6 +106,10 @@ class ProjectsController < ApplicationControllerendend+ def export_list_modal+ respond_with_dialog Projects::ExportListModalComponent.new(query: @query)+ end+privatedef has_managed_project_folders?(project)diff --git a/app/models/project.rb b/app/models/project.rbindex 3d32c42eeef..cb377c6b5ad 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -44,7 +44,7 @@ class Project < ApplicationRecordIDENTIFIER_MAX_LENGTH = 100# reserved identifiers- RESERVED_IDENTIFIERS = %w[new menu queries].freeze+ RESERVED_IDENTIFIERS = %w[new menu queries export_list_modal].freezehas_many :members, -> {# TODO: check whether this shoulddiff --git a/config/routes.rb b/config/routes.rbindex c54e101879c..0e787b7d514 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -248,6 +248,10 @@ Rails.application.routes.draw dopost :deactivate_work_package_attachmentsend+ collection do+ get :export_list_modal+ end+resources :versions, only: %i[new create] docollection doput :close_completeddiff --git a/lookbook/docs/patterns/05-dialogs.md.erb b/lookbook/docs/patterns/05-dialogs.md.erbindex e39a97bd432..12e96903868 100644--- a/lookbook/docs/patterns/05-dialogs.md.erb+++ b/lookbook/docs/patterns/05-dialogs.md.erb@@ -38,6 +38,18 @@ class TestController < ApplicationControlerend```+For this to work, the `OpTurbo::Streamable` module needs to be included in the modal component:++```ruby+class MyDialogComponent < ApplicationControler+ # include the module+ include OpTurbo::Streamable++ # ...+end+```++Assuming the MyDialogComponent template looks like this:```erbdiff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rbindex b2df97acf8d..1c6237428b6 100644--- a/spec/routing/project_routing_spec.rb+++ b/spec/routing/project_routing_spec.rb@@ -79,6 +79,14 @@ RSpec.describe ProjectsController doendend+ describe "export_list_modal" do+ it do+ expect(get("/projects/export_list_modal")).to route_to(+ controller: "projects", action: "export_list_modal"+ )+ end+ end+describe "templated" doit doexpect(delete("/projects/123/templated"))