From 045a7ac1564004856dc4cde0e624e4dfbe1dc034 Mon Sep 17 00:00:00 2001 From: Jannik Pulfer <109959802+RandomTannenbaum@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:37:01 +0100 Subject: [PATCH] Bug/770 fix person relations add button labels (#777) * Fix person relation labels with new method in actions_helper * Add translations for person relation new buttons to remaining languages * Make translations for new buttons match their category name * Normalize i18n files --- app/helpers/actions_helper.rb | 5 +++++ app/views/people/person_relations/_index.html.haml | 2 +- config/locales/de.yml | 12 ++++++++++++ config/locales/en.yml | 12 ++++++++++++ config/locales/fr.yml | 12 ++++++++++++ config/locales/it.yml | 12 ++++++++++++ 6 files changed, 54 insertions(+), 1 deletion(-) diff --git a/app/helpers/actions_helper.rb b/app/helpers/actions_helper.rb index c1c9f0395..cc4af322a 100644 --- a/app/helpers/actions_helper.rb +++ b/app/helpers/actions_helper.rb @@ -59,6 +59,11 @@ def add_action_link(path = nil, url_options = {}, html_options = {}) action_link(ti('link.add'), 'plus', path, html_options) end + def add_person_relation_link(path, person_relation_name, html_options) + path = new_polymorphic_path(path, url_options, html_options) unless path.is_a?(String) + action_link(t("people.#{person_relation_name}.link.add"), 'plus', path, html_options) + end + def add_action_link_modal(path = nil, url_options = {}) path ||= path_args(model_class) path = new_polymorphic_path(path, url_options) unless path.is_a?(String) diff --git a/app/views/people/person_relations/_index.html.haml b/app/views/people/person_relations/_index.html.haml index fc9f605da..23e7e3974 100644 --- a/app/views/people/person_relations/_index.html.haml +++ b/app/views/people/person_relations/_index.html.haml @@ -2,7 +2,7 @@ %div.profile-header.mw-100.border-bottom = "#{list.model_name.human(count: list.count)} (#{list.count})" %div.d-flex.flex-column.ms-5.mt-3.mb-3 - = add_action_link new_polymorphic_path([entry, name_of_obj(list).to_sym]), {}, data: { turbo_frame: dom_id(list.model.new)} + = add_person_relation_link new_polymorphic_path([entry, name_of_obj(list).to_sym]), list.model_name.collection, data: { turbo_frame: dom_id(list.model.new)} %div.border.rounded.border %turbo-frame{id: dom_id(list.model.new)} %turbo-frame{id: name_of_obj(list)} diff --git a/config/locales/de.yml b/config/locales/de.yml index 8019c37a8..73c635b95 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -176,8 +176,17 @@ de: single: ledig widowed: verwitwet people: + activities: + link: + add: Neue Station + advanced_trainings: + link: + add: Neue Weiterbildung cv: no_skills_rated_msg: Dieses Profil hat noch keine bewerteten Skills. Gehe zum Skills Tab und bewerte die für dich relevanten Skills. + educations: + link: + add: Neue Ausbildung export_cv: export_form: anonymised_cv: Anonymisierter CV @@ -206,6 +215,9 @@ de: core_competences: Kernkompetenzen personals: Personalien upload_image: Bild hochladen + projects: + link: + add: Neues Projekt scroll_to_menu: activities: Station advanced-trainings: Weiterbildungen diff --git a/config/locales/en.yml b/config/locales/en.yml index ac2c9c21e..b9e20f3f1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -172,8 +172,17 @@ en: single: single widowed: widowed people: + activities: + link: + add: New station + advanced_trainings: + link: + add: New further training cv: no_skills_rated_msg: This profile has no rated skills yet. Go to the Skills tab and rate the skills relevant to you. + educations: + link: + add: New education export_cv: export_form: anonymised_cv: Anonymized CV @@ -202,6 +211,9 @@ en: core_competences: Core competencies personals: Personal details upload_image: Upload image + projects: + link: + add: New project scroll_to_menu: activities: Station advanced-trainings: Further training diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ae83fa505..ce0cfe673 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -172,8 +172,17 @@ fr: single: célibataire widowed: veuf/veuve people: + activities: + link: + add: Nouvelle station + advanced_trainings: + link: + add: Nouvelle formation continue cv: no_skills_rated_msg: Ce profil n'a pas encore de skills évalués. Va dans l'onglet Skills et évalue les skills qui te concernent. + educations: + link: + add: Nouvelle formation export_cv: export_form: anonymised_cv: CV anonyme @@ -202,6 +211,9 @@ fr: core_competences: Compétences clés personals: Données personnelles upload_image: Télécharger une image + projects: + link: + add: Nouveau projet scroll_to_menu: activities: Station advanced-trainings: Formations continues diff --git a/config/locales/it.yml b/config/locales/it.yml index 808322a7e..25235a13f 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -172,8 +172,17 @@ it: single: singolo widowed: vedova people: + activities: + link: + add: Nuova Stazione + advanced_trainings: + link: + add: Nuova formazione continua cv: no_skills_rated_msg: Questo profilo non ha ancora competenze valutate. Andate alla scheda Competenze e valutate le competenze che vi interessano. + educations: + link: + add: Nuovo programma di formazione export_cv: export_form: anonymised_cv: CV anonimo @@ -202,6 +211,9 @@ it: core_competences: Competenze di base personals: Dati personali upload_image: Carica immagine + projects: + link: + add: Nuovo progetto scroll_to_menu: activities: Stazione advanced-trainings: Formazione continua