Skip to content

Commit

Permalink
Render more info link in setup component
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Jul 22, 2024
1 parent 2228d07 commit 455b9b2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
</button>
</div>
<p><%= t("cookies_setup.description") %><p>
<% if more_info_link.present? %>
<p><%= link_to t("cookies_consent.more_info_link"), more_info_link, target: "_blank" %></p>
<% end %>

<h3><%= t("cookies_setup.essentials.title") %></h3>
<p><%= t("cookies_setup.essentials.description") %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ def notice
def vendors
Cookies::Vendor.all
end

private

def more_info_link
Setting["cookies_consent.more_info_link"]
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,20 @@

expect(page).not_to have_css(".cookies-consent-setup")
end

it "renders a link when the setting `cookies_consent.more_info_link` is defined" do
Setting["cookies_consent.more_info_link"] = "/cookies_policy"

render_inline Layout::CookiesConsent::SetupComponent.new

expect(page).to have_link("More information", href: "/cookies_policy")
end

it "does not renders a link when the setting `cookies_consent.more_info_link` is not defined" do
Setting["cookies_consent.more_info_link"] = ""

render_inline Layout::CookiesConsent::SetupComponent.new

expect(page).not_to have_link("More information")
end
end

0 comments on commit 455b9b2

Please sign in to comment.