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
Define shared stimulus controllers mixin for activities tab
Kabiru Mwenja925449220275
diff --git a/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb b/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rbnew file mode 100644index 00000000000..246ec976f66--- /dev/null+++ b/app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb@@ -0,0 +1,45 @@+# 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 WorkPackages+ module ActivitiesTab+ module StimulusControllers+ def index_stimulus_controller(suffix = nil) = "work-packages--activities-tab--index#{suffix}"+ def restricted_comment_stimulus_controller(suffix = nil) = "work-packages--activities-tab--restricted-comment#{suffix}"+ def quote_comments_stimulus_controller(suffix = nil) = "work-packages--activities-tab--quote-comment#{suffix}"++ def items_index_selector = "##{WorkPackages::ActivitiesTab::IndexComponent.wrapper_key}"++ def add_comment_selector+ "##{WorkPackages::ActivitiesTab::IndexComponent.add_comment_wrapper_key}"+ end+ end+ end+enddiff --git a/app/components/work_packages/activities_tab/index_component.rb b/app/components/work_packages/activities_tab/index_component.rbindex b48b8fd2686..ac3749569da 100644--- a/app/components/work_packages/activities_tab/index_component.rb+++ b/app/components/work_packages/activities_tab/index_component.rb@@ -35,6 +35,7 @@ module WorkPackagesinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamableinclude WorkPackages::ActivitiesTab::SharedHelpers+ include WorkPackages::ActivitiesTab::StimulusControllersdef initialize(work_package:, last_server_timestamp:, filter: :all, deferred: false)super@@ -96,9 +97,6 @@ module WorkPackagesUser.current.allowed_in_work_package?(:add_work_package_notes, @work_package)end- def index_stimulus_controller(suffix = nil) = "work-packages--activities-tab--index#{suffix}"- def restricted_comment_stimulus_controller(suffix = nil) = "work-packages--activities-tab--restricted-comment#{suffix}"-def unsaved_changes_confirmation_messageI18n.t("activities.work_packages.activity_tab.unsaved_changes_confirmation_message")enddiff --git a/app/components/work_packages/activities_tab/journals/item_component.rb b/app/components/work_packages/activities_tab/journals/item_component.rbindex 43d954a92da..33a17ec5a57 100644--- a/app/components/work_packages/activities_tab/journals/item_component.rb+++ b/app/components/work_packages/activities_tab/journals/item_component.rb@@ -31,9 +31,10 @@ module WorkPackagesmodule Journalsclass ItemComponent < ApplicationComponentinclude ApplicationHelper- include WorkPackages::ActivitiesTab::SharedHelpersinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable+ include WorkPackages::ActivitiesTab::SharedHelpers+ include WorkPackages::ActivitiesTab::StimulusControllersdef initialize(journal:, filter:, grouped_emoji_reactions:, state: :show)super@@ -157,16 +158,6 @@ module WorkPackagestest_selector: "op-wp-journal-#{journal.id}-quote"}end-- def quote_comments_stimulus_controller(suffix = nil) = "work-packages--activities-tab--quote-comment#{suffix}"- def index_stimulus_controller(suffix = nil) = "work-packages--activities-tab--index#{suffix}"- def restricted_comment_stimulus_controller(suffix = nil) = "work-packages--activities-tab--restricted-comment#{suffix}"-- def items_index_selector = "##{WorkPackages::ActivitiesTab::IndexComponent.wrapper_key}"-- def add_comment_selector- "##{WorkPackages::ActivitiesTab::IndexComponent.add_comment_wrapper_key}"- endendendend