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

Merge DialogStreamHelper into ComponentStream

Jan Sandbrinkf824b479e826
diff --git a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
index 1607b81037b..933b5b8a35d 100644
--- a/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
+++ b/app/controllers/admin/custom_fields/custom_field_projects_controller.rb
@@ -30,7 +30,6 @@
class Admin::CustomFields::CustomFieldProjectsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include FlashMessagesOutputSafetyHelper
layout "admin"
diff --git a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
index ed67330f040..3af126a8ca1 100644
--- a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
+++ b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb
@@ -33,7 +33,6 @@ module Admin
module Hierarchy
class ItemsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
layout :admin_or_frame_layout
model_object CustomField
diff --git a/app/controllers/admin/settings/project_custom_field_sections_controller.rb b/app/controllers/admin/settings/project_custom_field_sections_controller.rb
index 85248086b73..35646229f79 100644
--- a/app/controllers/admin/settings/project_custom_field_sections_controller.rb
+++ b/app/controllers/admin/settings/project_custom_field_sections_controller.rb
@@ -30,7 +30,6 @@ module Admin::Settings
class ProjectCustomFieldSectionsController < ::Admin::SettingsController
include OpTurbo::ComponentStream
include Admin::Settings::ProjectCustomFields::ComponentStreams
- include OpTurbo::DialogStreamHelper
before_action :set_project_custom_field_section, only: %i[update move drop destroy]
diff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rb
index 8a2b082630f..25da615cd9a 100644
--- a/app/controllers/admin/settings/project_custom_fields_controller.rb
+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb
@@ -30,7 +30,6 @@ module Admin::Settings
class ProjectCustomFieldsController < ::Admin::SettingsController
include CustomFields::SharedActions
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include FlashMessagesOutputSafetyHelper
include Admin::Settings::ProjectCustomFields::ComponentStreams
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index d9f970788f3..effd3bbf80a 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -28,7 +28,6 @@
class AttributeHelpTextsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
layout "admin"
menu_item :attribute_help_texts
diff --git a/app/controllers/concerns/op_turbo/component_stream.rb b/app/controllers/concerns/op_turbo/component_stream.rb
index 2c606da0ea4..ccec531c515 100644
--- a/app/controllers/concerns/op_turbo/component_stream.rb
+++ b/app/controllers/concerns/op_turbo/component_stream.rb
@@ -42,6 +42,12 @@ module OpTurbo
alias_method :respond_with_turbo_streams, :respond_to_with_turbo_streams
+ def respond_with_dialog(dialog_component, status: :ok, &format_block)
+ modify_via_turbo_stream(component: dialog_component, action: :dialog, status:)
+
+ respond_to_with_turbo_streams(&format_block)
+ end
+
def update_via_turbo_stream(component:, status: :ok, method: nil)
modify_via_turbo_stream(component:, action: :update, status:, method:)
end
diff --git a/app/controllers/concerns/op_turbo/dialog_stream_helper.rb b/app/controllers/concerns/op_turbo/dialog_stream_helper.rb
deleted file mode 100644
index 9dbfef59aa9..00000000000
--- a/app/controllers/concerns/op_turbo/dialog_stream_helper.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# frozen_string_literal: true
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-#++
-
-module OpTurbo
- module DialogStreamHelper
- def respond_with_dialog(dialog_component, status: :ok, &format_block)
- modify_via_turbo_stream(component: dialog_component, action: :dialog, status:)
-
- respond_to_with_turbo_streams(&format_block)
- end
- end
-end
diff --git a/app/controllers/enterprise_tokens_controller.rb b/app/controllers/enterprise_tokens_controller.rb
index 53603ee0339..b2d19d79c67 100644
--- a/app/controllers/enterprise_tokens_controller.rb
+++ b/app/controllers/enterprise_tokens_controller.rb
@@ -28,7 +28,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
class EnterpriseTokensController < ApplicationController
- include OpTurbo::DialogStreamHelper
include OpTurbo::ComponentStream
include OpModalFlashable
diff --git a/app/controllers/enterprise_trials_controller.rb b/app/controllers/enterprise_trials_controller.rb
index 082f1c25d99..188526164ee 100644
--- a/app/controllers/enterprise_trials_controller.rb
+++ b/app/controllers/enterprise_trials_controller.rb
@@ -29,7 +29,6 @@
#++
class EnterpriseTrialsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
before_action :require_admin
before_action :load_trial_key, only: %i[request_resend]
diff --git a/app/controllers/projects/queries_controller.rb b/app/controllers/projects/queries_controller.rb
index f8fef33a06c..58241e8489b 100644
--- a/app/controllers/projects/queries_controller.rb
+++ b/app/controllers/projects/queries_controller.rb
@@ -29,7 +29,6 @@
class Projects::QueriesController < ApplicationController
include Queries::Loading
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
# No need for a more specific authorization check. That is carried out in the contracts.
no_authorization_required! :show, :new, :create, :rename, :update, :toggle_public, :destroy, :destroy_confirmation_modal,
diff --git a/app/controllers/projects/settings/general_controller.rb b/app/controllers/projects/settings/general_controller.rb
index 2318c0f363b..4d5f63df3b2 100644
--- a/app/controllers/projects/settings/general_controller.rb
+++ b/app/controllers/projects/settings/general_controller.rb
@@ -30,7 +30,6 @@
class Projects::Settings::GeneralController < Projects::SettingsController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
menu_item :settings_general
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 12e3c69d7a5..3000fd9c615 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -28,7 +28,6 @@
class ProjectsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
menu_item :overview
menu_item :roadmap, only: :roadmap
diff --git a/app/controllers/shares_controller.rb b/app/controllers/shares_controller.rb
index f020a2c9d5a..3ea98b841e6 100644
--- a/app/controllers/shares_controller.rb
+++ b/app/controllers/shares_controller.rb
@@ -28,7 +28,6 @@
class SharesController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include MemberHelper
before_action :load_entity
diff --git a/app/controllers/work_package_hierarchy_relations_controller.rb b/app/controllers/work_package_hierarchy_relations_controller.rb
index 262750112f7..66cf444a2b5 100644
--- a/app/controllers/work_package_hierarchy_relations_controller.rb
+++ b/app/controllers/work_package_hierarchy_relations_controller.rb
@@ -30,7 +30,6 @@
class WorkPackageHierarchyRelationsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
class InvalidRelationType < StandardError; end
diff --git a/app/controllers/work_package_relations_controller.rb b/app/controllers/work_package_relations_controller.rb
index 196b8a001fb..98699eee7b1 100644
--- a/app/controllers/work_package_relations_controller.rb
+++ b/app/controllers/work_package_relations_controller.rb
@@ -30,7 +30,6 @@
class WorkPackageRelationsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
before_action :set_work_package
before_action :set_relation, only: %i[edit update]
diff --git a/app/controllers/work_packages/dialogs_controller.rb b/app/controllers/work_packages/dialogs_controller.rb
index dd32d35cdbb..4caba9713a1 100644
--- a/app/controllers/work_packages/dialogs_controller.rb
+++ b/app/controllers/work_packages/dialogs_controller.rb
@@ -30,7 +30,6 @@
class WorkPackages::DialogsController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
layout false
before_action :find_project_by_project_id
diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rb
index e7f3ab50b73..2bf6c7d59a9 100644
--- a/app/controllers/work_packages_controller.rb
+++ b/app/controllers/work_packages_controller.rb
@@ -31,7 +31,6 @@ class WorkPackagesController < ApplicationController
include PaginationHelper
include Layout
include WorkPackagesControllerHelper
- include OpTurbo::DialogStreamHelper
include OpTurbo::ComponentStream
accept_key_auth :index, :show
diff --git a/lookbook/docs/patterns/05-dialogs.md.erb b/lookbook/docs/patterns/05-dialogs.md.erb
index c17d61aa34a..f970d45f4cd 100644
--- a/lookbook/docs/patterns/05-dialogs.md.erb
+++ b/lookbook/docs/patterns/05-dialogs.md.erb
@@ -28,9 +28,8 @@ The async-controller stimulus controller will ensure that a loading progress bar
```ruby
class TestController < ApplicationControler
- # include the helper modules
+ # include the helper module
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
# ...
@@ -40,7 +39,7 @@ class TestController < ApplicationControler
end
```
-For this to work, the `OpTurbo::Streamable` module needs to be included in the modal component, along with the `OpTurbo::DialogStreamHelper` and `OpTurbo::ComponentStream` modules in the corresponding controller:
+For this to work, the `OpTurbo::Streamable` module needs to be included in the modal component, along with the `OpTurbo::ComponentStream` module in the corresponding controller:
```ruby
class MyDialogComponent < ApplicationControler
@@ -142,9 +141,8 @@ Referring to the example above (see "Dialogs with separate forms"), a controller
```ruby
class TestController < ApplicationControler
- # include the helper modules
+ # include the helper module
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
# ...
diff --git a/modules/costs/app/controllers/time_entries_controller.rb b/modules/costs/app/controllers/time_entries_controller.rb
index 3e5444bb2d3..9f8f81cdb65 100644
--- a/modules/costs/app/controllers/time_entries_controller.rb
+++ b/modules/costs/app/controllers/time_entries_controller.rb
@@ -30,7 +30,6 @@
class TimeEntriesController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include Redmine::I18n
before_action :require_login
diff --git a/modules/job_status/app/controllers/job_statuses_controller.rb b/modules/job_status/app/controllers/job_statuses_controller.rb
index c775f8216af..6e711d956f7 100644
--- a/modules/job_status/app/controllers/job_statuses_controller.rb
+++ b/modules/job_status/app/controllers/job_statuses_controller.rb
@@ -28,7 +28,6 @@
class JobStatusesController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
no_authorization_required! :show, :dialog, :dialog_body
before_action :validate_job, only: [:dialog_body]
diff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rb
index 7eb8d7d87f1..b7376df6dc5 100644
--- a/modules/meeting/app/controllers/meeting_sections_controller.rb
+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb
@@ -30,7 +30,6 @@
class MeetingSectionsController < ApplicationController
include AttachableServiceCall
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include Meetings::AgendaComponentStreams
before_action :set_meeting
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 56e7e3abad0..13b2da65081 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -50,7 +50,6 @@ class MeetingsController < ApplicationController
include OpTurbo::ComponentStream
include OpTurbo::FlashStreamHelper
- include OpTurbo::DialogStreamHelper
include Meetings::AgendaComponentStreams
include MetaTagsHelper
diff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rb
index 901b5c40bef..0f82d4af99d 100644
--- a/modules/meeting/app/controllers/recurring_meetings_controller.rb
+++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb
@@ -5,7 +5,6 @@ class RecurringMeetingsController < ApplicationController
include PaginationHelper
include OpTurbo::ComponentStream
include OpTurbo::FlashStreamHelper
- include OpTurbo::DialogStreamHelper
before_action :load_and_authorize_in_optional_project
before_action :find_meeting, except: %i[index new create]
diff --git a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
index 172a5e1233e..2634fdebc48 100644
--- a/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
+++ b/modules/meeting/app/controllers/work_package_meetings_tab_controller.rb
@@ -30,7 +30,6 @@
class WorkPackageMeetingsTabController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include Meetings::WorkPackageMeetingsTabComponentStreams
before_action :set_work_package
diff --git a/modules/overviews/app/controllers/overviews/overviews_controller.rb b/modules/overviews/app/controllers/overviews/overviews_controller.rb
index 9376f05c2d2..b88e8c6e979 100644
--- a/modules/overviews/app/controllers/overviews/overviews_controller.rb
+++ b/modules/overviews/app/controllers/overviews/overviews_controller.rb
@@ -29,7 +29,6 @@
module ::Overviews
class OverviewsController < ::Grids::BaseInProjectController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
before_action :jump_to_project_menu_item
before_action :set_sidebar_enabled
diff --git a/modules/overviews/app/controllers/overviews/project_phases_controller.rb b/modules/overviews/app/controllers/overviews/project_phases_controller.rb
index 13dd5174465..2498292c41c 100644
--- a/modules/overviews/app/controllers/overviews/project_phases_controller.rb
+++ b/modules/overviews/app/controllers/overviews/project_phases_controller.rb
@@ -31,7 +31,6 @@
module ::Overviews
class ProjectPhasesController < ::ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
before_action :find_project_phase_and_project
before_action :authorize
diff --git a/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb
index e82221a0877..50620da35b2 100644
--- a/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages/project_storages_controller.rb
@@ -30,7 +30,6 @@
class Storages::Admin::Storages::ProjectStoragesController < ApplicationController
include OpTurbo::ComponentStream
- include OpTurbo::DialogStreamHelper
include FlashMessagesOutputSafetyHelper
include Storages::OAuthAccessGrantable