Simplify code in social component

This commit is contained in:
Javi Martín
2021-05-06 19:35:26 +02:00
parent 3b00f3c141
commit 211ed101b9
3 changed files with 30 additions and 17 deletions

View File

@@ -10,6 +10,18 @@ class Layout::SocialComponent < ApplicationComponent
youtube: "https://www.youtube.com",
telegram: "https://www.telegram.me",
instragram: "https://www.instagram.com"
}
}.select { |name, _| setting["#{name}_handle"] }
end
def link_title(site_name)
t("shared.go_to_page") + link_text(site_name) + t("shared.target_blank")
end
def link_text(site_name)
t("social.#{site_name}", org: setting["org_name"])
end
def footer_content_block
content_block("footer", I18n.locale)
end
end