As mentioned in earlier commits, opening external links in a new tab/window results in usability and accessibility issues. Since these links are usually at the top or bottom of the page and contain icons of well-known sites, IMHO there's no need to even notify people that these are external links. Since we're no longer using the `shared.target_blank` translation inside a sentence, we can remove the space and parenthesis in the translations.
32 lines
748 B
Ruby
32 lines
748 B
Ruby
class Layout::SocialComponent < ApplicationComponent
|
|
delegate :content_block, to: :helpers
|
|
|
|
def render?
|
|
sites.any? || footer_content_block.present?
|
|
end
|
|
|
|
private
|
|
|
|
def sites
|
|
{
|
|
twitter: "https://twitter.com",
|
|
facebook: "https://www.facebook.com",
|
|
youtube: "https://www.youtube.com",
|
|
telegram: "https://www.telegram.me",
|
|
instagram: "https://www.instagram.com"
|
|
}.select { |name, _| setting["#{name}_handle"].present? }
|
|
end
|
|
|
|
def link_title(site_name)
|
|
t("shared.go_to_page") + link_text(site_name)
|
|
end
|
|
|
|
def link_text(site_name)
|
|
t("social.#{site_name}", org: setting["org_name"])
|
|
end
|
|
|
|
def footer_content_block
|
|
content_block("footer")
|
|
end
|
|
end
|