Rename folder method in SDG icon component

The method name was a bit confusing because it returned a locale.
This commit is contained in:
Javi Martín
2021-06-18 13:37:27 +02:00
parent f5a5ac5f1f
commit 5de90547a7

View File

@@ -7,7 +7,7 @@ class SDG::Goals::IconComponent < ApplicationComponent
end
def image_path
"sdg/#{folder}/goal_#{code}.png"
"sdg/#{locale}/goal_#{code}.png"
end
private
@@ -16,9 +16,9 @@ class SDG::Goals::IconComponent < ApplicationComponent
goal.code_and_title
end
def folder
[*I18n.fallbacks[I18n.locale], "default"].find do |locale|
AssetFinder.find_asset("sdg/#{locale}/goal_#{code}.png")
def locale
[*I18n.fallbacks[I18n.locale], "default"].find do |fallback|
AssetFinder.find_asset("sdg/#{fallback}/goal_#{code}.png")
end
end
end