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

[#51174] Update the button labels for the automatically managed form to change based on checkbox active (#14302)

Kabiru Mwenja0d4086c23cc9
diff --git a/frontend/src/stimulus/controllers/dynamic/storages/automatically-managed-project-folders-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/storages/automatically-managed-project-folders-form.controller.ts
index 56f0c0b5cf1..650fa576032 100644
--- a/frontend/src/stimulus/controllers/dynamic/storages/automatically-managed-project-folders-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/storages/automatically-managed-project-folders-form.controller.ts
@@ -33,16 +33,22 @@ import { Controller } from '@hotwired/stimulus';
export default class AutomaticallyManagedProjectFoldersFormController extends Controller {
static targets = [
'applicationPasswordInput',
+ 'submitButton',
];
static values = {
isAutomaticallyManaged: Boolean,
+ doneCompleteLabel: String,
+ doneCompleteWithoutLabel: String,
};
declare readonly applicationPasswordInputTarget:HTMLElement;
+ declare readonly submitButtonTarget:HTMLElement;
declare readonly hasApplicationPasswordInputTarget:boolean;
declare isAutomaticallyManagedValue:boolean;
+ declare doneCompleteLabelValue:string;
+ declare doneCompleteWithoutLabelValue:string;
connect():void {
// On first load if isAutomaticallyManaged is true, show the applicationPasswordInput
@@ -60,8 +66,10 @@ export default class AutomaticallyManagedProjectFoldersFormController extends Co
if (displayApplicationPasswordInput) {
this.applicationPasswordInputTarget.style.display = 'flex';
+ this.submitButtonTarget.textContent = this.doneCompleteLabelValue;
} else {
this.applicationPasswordInputTarget.style.display = 'none';
+ this.submitButtonTarget.textContent = this.doneCompleteWithoutLabelValue;
}
}
}
diff --git a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
index ceed94efda4..5d0bb3d8f0c 100644
--- a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
@@ -8,6 +8,8 @@
controller: "storages--automatically-managed-project-folders-form",
'application-target': "dynamic",
'storages--automatically-managed-project-folders-form-is-automatically-managed-value': storage.automatically_managed?,
+ 'storages--automatically-managed-project-folders-form-done-complete-label-value': I18n.t("storages.buttons.done_complete_setup"),
+ 'storages--automatically-managed-project-folders-form-done-complete-without-label-value': I18n.t("storages.buttons.complete_without_setup"),
}
) do |form|
flex_layout do |project_folders_form|
diff --git a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
index 7ad495021f5..ca858b1b4f1 100644
--- a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
+++ b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
@@ -42,7 +42,8 @@ module Storages::Admin::Forms
end
def submit_button_options
- { label: I18n.t("storages.buttons.done_complete_setup") }.tap do |options_hash|
+ { label: I18n.t("storages.buttons.done_complete_setup"),
+ data: { 'storages--automatically-managed-project-folders-form-target': 'submitButton' } }.tap do |options_hash|
# For create action, break from Turbo Frame and follow full page redirect
options_hash[:data] = { turbo: false } if new_record?
end
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index 95dd733c69d..9a6e9cb790f 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -74,6 +74,7 @@ en:
done_continue: "Done, continue"
done_continue_setup: "Done. Continue setup"
done_complete_setup: "Done, complete setup"
+ complete_without_setup: "Complete without it"
edit_automatically_managed_project_folders: "Edit automatically managed project folders"
replace_openproject_oauth: "Replace OpenProject OAuth"
replace_provider_type_oauth: "Replace %{provider_type} OAuth"