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
added project count on global project attributes settings page
Jonas Jabari5d97caf300f7
diff --git a/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb b/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erbindex e558b1d5915..d376d4ebcb3 100644--- a/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb+++ b/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb@@ -16,11 +16,16 @@@project_custom_field.nameendend- content_container.with_column do+ content_container.with_column(mr: 2) dorender(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do@project_custom_field.field_format.capitalizeendend+ content_container.with_column do+ render(Primer::Beta::Text.new(font_size: :small)) do+ project_count_text+ end+ endendmain_container.with_column dorender(Primer::Alpha::ActionMenu.new) do |menu|diff --git a/app/components/settings/project_custom_field_sections/custom_field_row_component.rb b/app/components/settings/project_custom_field_sections/custom_field_row_component.rbindex b36e95c8ef7..3dc7976b6d7 100644--- a/app/components/settings/project_custom_field_sections/custom_field_row_component.rb+++ b/app/components/settings/project_custom_field_sections/custom_field_row_component.rb@@ -79,6 +79,16 @@ module Settingsitem.with_leading_visual_icon(icon: :trash)endend++ def project_count_text+ project_count = @project_custom_field.project_custom_field_project_mappings.size++ if project_count == 1+ "#{project_count} #{t('activerecord.models.project')}"+ else+ "#{project_count} #{t('label_project_plural')}"+ end+ endendendenddiff --git a/app/controllers/admin/settings/project_custom_fields_controller.rb b/app/controllers/admin/settings/project_custom_fields_controller.rbindex 67317050e22..617b6cc23ca 100644--- a/app/controllers/admin/settings/project_custom_fields_controller.rb+++ b/app/controllers/admin/settings/project_custom_fields_controller.rb@@ -116,7 +116,9 @@ module Admin::Settingsenddef set_sections- @project_custom_field_sections = ProjectCustomFieldSection.all+ @project_custom_field_sections = ProjectCustomFieldSection+ .includes(custom_fields: :project_custom_field_project_mappings)+ .allenddef find_custom_field