From 05345fb43c54d632bfd18405c0707c150b28a805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 8 Oct 2023 22:15:38 +0200 Subject: [PATCH] Extract methods in footer component This way it'll be easier to change and refactor this code. --- app/components/layout/footer_component.html.erb | 4 ++-- app/components/layout/footer_component.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/components/layout/footer_component.html.erb b/app/components/layout/footer_component.html.erb index dc9a559fd..0122798b1 100644 --- a/app/components/layout/footer_component.html.erb +++ b/app/components/layout/footer_component.html.erb @@ -7,8 +7,8 @@

<%= sanitize(t("layouts.footer.description", - open_source: link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "_blank", rel: "nofollow"), - consul: link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "_blank", rel: "nofollow"))) %> + open_source: open_source_link, + consul: repository_link)) %>

diff --git a/app/components/layout/footer_component.rb b/app/components/layout/footer_component.rb index 0f092f247..17dce63f0 100644 --- a/app/components/layout/footer_component.rb +++ b/app/components/layout/footer_component.rb @@ -4,4 +4,16 @@ class Layout::FooterComponent < ApplicationComponent def footer_legal_content_block content_block("footer_legal") end + + private + + def open_source_link + link_to(t("layouts.footer.open_source"), t("layouts.footer.open_source_url"), target: "_blank", + rel: "nofollow") + end + + def repository_link + link_to(t("layouts.footer.consul"), t("layouts.footer.consul_url"), target: "_blank", + rel: "nofollow") + end end