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

Declare restricted comment highlight class as stimulus class attributes

Kabiru Mwenja570cb3025d47
diff --git a/app/components/work_packages/activities_tab/index_component.rb b/app/components/work_packages/activities_tab/index_component.rb
index bdcc3f6b4bd..1454db30a84 100644
--- a/app/components/work_packages/activities_tab/index_component.rb
+++ b/app/components/work_packages/activities_tab/index_component.rb
@@ -76,7 +76,8 @@ module WorkPackages
controller: stimulus_controller,
"application-target": "dynamic",
"#{stimulus_controller}-target": "formContainer",
- action: "#{activities_tab_index_stimulus_controller}:onSubmit-end@window->#{stimulus_controller}#onSubmitEnd"
+ action: "#{activities_tab_index_stimulus_controller}:onSubmit-end@window->#{stimulus_controller}#onSubmitEnd",
+ "#{stimulus_controller}-highlight-class": "work-packages-activities-tab-journals-new-component--journal-notes-body__restricted-comment" # rubocop:disable Layout/LineLength
}
end
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts
index 5ec52c56182..b65dac80f10 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/restricted-comment.controller.ts
@@ -32,11 +32,11 @@ import { Controller } from '@hotwired/stimulus';
export default class RestrictedCommentController extends Controller {
static targets = ['restrictedCheckbox', 'formContainer'];
+ static classes = ['highlight'];
declare readonly restrictedCheckboxTarget:HTMLInputElement;
declare readonly formContainerTarget:HTMLElement;
-
- private restrictedCommentBgColorClass:string = 'work-packages-activities-tab-journals-new-component--journal-notes-body__restricted-comment';
+ declare readonly highlightClass:string;
onSubmitEnd(_event:CustomEvent):void {
this.toggleBackgroundColor();
@@ -44,9 +44,9 @@ export default class RestrictedCommentController extends Controller {
toggleBackgroundColor():void {
if (this.restrictedCheckboxTarget.checked) {
- this.formContainerTarget.classList.add(this.restrictedCommentBgColorClass);
+ this.formContainerTarget.classList.add(this.highlightClass);
} else {
- this.formContainerTarget.classList.remove(this.restrictedCommentBgColorClass);
+ this.formContainerTarget.classList.remove(this.highlightClass);
}
}
}