Extract method to get the text of the section link

So we can override it when using inheritance.
This commit is contained in:
Senén Rodero Rodríguez
2021-01-12 11:24:38 +01:00
parent a0c9eba41d
commit 2744362dc7

View File

@@ -12,9 +12,11 @@ class SDGManagement::SubnavigationComponent < ApplicationComponent
end
def link_to_section(section)
link_to "SDG::#{section.to_s.classify}".constantize.model_name.human(count: 2).titleize,
path_for(section),
class: active_style(section)
link_to text_for(section), path_for(section), class: active_style(section)
end
def text_for(section)
"SDG::#{section.to_s.classify}".constantize.model_name.human(count: 2).titleize
end
def path_for(section)