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

Update flash messages for activating sutom fields on types and projects

Dombi Attila7066ea62d5ef
diff --git a/app/controllers/projects/settings/types_controller.rb b/app/controllers/projects/settings/types_controller.rb
index 30cc0510d02..e5f14ee1805 100644
--- a/app/controllers/projects/settings/types_controller.rb
+++ b/app/controllers/projects/settings/types_controller.rb
@@ -35,11 +35,20 @@ class Projects::Settings::TypesController < Projects::SettingsController
def update
if UpdateProjectsTypesService.new(@project).call(permitted_params.projects_type_ids)
- flash[:notice] = I18n.t('notice_successful_update')
+ flash[:notice] = success_message
else
flash[:error] = @project.errors.full_messages
end
redirect_to project_settings_types_path(@project.identifier)
end
+
+ private
+
+ def success_message
+ ApplicationController.helpers.sanitize(
+ t(:notice_successful_update_custom_fields_added_to_project, url: project_settings_custom_fields_path(@project)),
+ attributes: %w(href target)
+ )
+ end
end
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb
index 3291d027569..841753ca30d 100644
--- a/app/controllers/types_controller.rb
+++ b/app/controllers/types_controller.rb
@@ -84,7 +84,7 @@ class TypesController < ApplicationController
.new(@type, current_user)
.call(permitted_type_params) do |call|
call.on_success do
- redirect_to_type_tab_path(@type, t(:notice_successful_update))
+ redirect_to_type_tab_path(@type, update_success_message)
end
call.on_failure do |result|
@@ -159,6 +159,14 @@ class TypesController < ApplicationController
true
end
+ def update_success_message
+ if params[:tab].in?(["form_configuration", "projects"])
+ t(:notice_successful_update_custom_fields_added_to_type)
+ else
+ t(:notice_successful_update)
+ end
+ end
+
def destroy_error_message
if @type.is_standard?
t(:error_can_not_delete_standard_type)
@@ -183,6 +191,6 @@ class TypesController < ApplicationController
end
def belonging_wps_url(type_id)
- work_packages_path query_props: '{"f":[{"n":"type","o":"=","v":[' + type_id.to_s + ']}]}'
+ work_packages_path query_props: "{\"f\":[{\"n\":\"type\",\"o\":\"=\",\"v\":[#{type_id}]}]}"
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 08db2497ca0..8e398a63755 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2208,6 +2208,12 @@ en:
notice_successful_create: "Successful creation."
notice_successful_delete: "Successful deletion."
notice_successful_update: "Successful update."
+ notice_successful_update_custom_fields_added_to_project: |
+ Successful update. The custom fields of the activated types are automatically activated
+ on the work package form. <a href="%{url}" target="_blank">See more</a>.
+ notice_successful_update_custom_fields_added_to_type: |
+ Successful update. The active custom fields are automatically activated for
+ the associated projects of this type.
notice_to_many_principals_to_display: "There are too many results.\nNarrow down the search by typing in the name of the new member (or group)."
notice_user_missing_authentication_method: User has yet to choose a password or another way to sign in.
notice_user_invitation_resent: An invitation has been sent to %{email}.