Skip to content

Commit

Permalink
Fix person relation labels with new method in actions_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Nov 20, 2024
1 parent 1737b2a commit a73a22e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/helpers/actions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/person_relations/_index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
12 changes: 12 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ de:
search:
new_profile: Neues Profil
updated_at: Zuletzt bearbeitet
educations:
link:
add: Neue Ausbildung
activities:
link:
add: Neue Station
advanced_trainings:
link:
add: Neue Weiterbildung
projects:
link:
add: Neues Projekt
people/people_skills:
edit_form:
rate: Bewerten
Expand Down

0 comments on commit a73a22e

Please sign in to comment.