From fdb15b5f8109fe397a89a550d8af16b12436883c Mon Sep 17 00:00:00 2001 From: Henriette Darge Date: Fri, 29 Nov 2024 12:45:37 +0100 Subject: [PATCH] Change title for "Lag" field and make it a number field --- .../work_package_relations_tab/relation_component.html.erb | 6 ++---- .../work_package_relations_tab/relation_component.rb | 4 ++++ .../work_package_relation_form_component.html.erb | 3 ++- config/locales/en.yml | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/components/work_package_relations_tab/relation_component.html.erb b/app/components/work_package_relations_tab/relation_component.html.erb index 845b5cd6475a..b4cdd78822b4 100644 --- a/app/components/work_package_relations_tab/relation_component.html.erb +++ b/app/components/work_package_relations_tab/relation_component.html.erb @@ -66,8 +66,7 @@ flex_layout do |flex| end dates_row.with_column(mr: 3) do render(Primer::Beta::Text.new) do - "#{I18n.t("work_package_relations_tab.lag.title")}: #{I18n.t('datetime.distance_in_words.x_days', - count: relation.lag)}" + lag_as_text(relation.lag) end end end @@ -95,8 +94,7 @@ flex_layout do |flex| end dates_row.with_column(mr: 1) do render(Primer::Beta::Text.new) do - "#{I18n.t("work_package_relations_tab.lag.title")}: #{I18n.t('datetime.distance_in_words.x_days', - count: relation.lag)}" + lag_as_text(relation.lag) end end end diff --git a/app/components/work_package_relations_tab/relation_component.rb b/app/components/work_package_relations_tab/relation_component.rb index 18305fceb005..2e3159517dcb 100644 --- a/app/components/work_package_relations_tab/relation_component.rb +++ b/app/components/work_package_relations_tab/relation_component.rb @@ -95,6 +95,10 @@ def destroy_path end end + def lag_as_text(lag) + "#{I18n.t('work_package_relations_tab.lag.subject')}: #{I18n.t('datetime.distance_in_words.x_days', count: lag)}" + end + def action_menu_test_selector "op-relation-row-#{underlying_resource_id}-action-menu" end diff --git a/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb b/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb index fb5f19b82d3a..265c386fd474 100644 --- a/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb +++ b/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb @@ -63,7 +63,8 @@ if lag_shown my_form.text_field( name: :lag, - label: Relation.human_attribute_name(:lag), + type: :number, + label: I18n.t("work_package_relations_tab.lag.title"), caption: I18n.t("work_package_relations_tab.lag.caption"), input_width: :small, ) diff --git a/config/locales/en.yml b/config/locales/en.yml index 387c253df5d9..354204222c66 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -717,7 +717,8 @@ en: label_edit_x: "Edit %{x}" label_add_description: "Add description" lag: - title: "Lag" + subject: "Lag" + title: "Lag (in days)" caption: "The gap in number of working days in between the two work packages" relations: label_relates_singular: "related to"