Files
openfoodnetwork/app/helpers/link_helper.rb
Maikel Linke 64a8b5845a Add feature toggle open_in_same_tab for admin dashboard
This allows us to test what users actually want.
2025-03-11 16:38:51 +11:00

27 lines
499 B
Ruby

# frozen_string_literal: true
module LinkHelper
def link_to_service(baseurl, name, html_options = {}, &)
return if name.blank?
html_options = html_options.merge target: '_blank'
link_to(ext_url(baseurl, name), html_options, &)
end
def ext_url(prefix, url)
if url =~ %r{^https?://}i
url
else
prefix + url
end
end
def new_tab_option
if feature?(:open_in_same_tab, spree_current_user)
{}
else
{ target: "_blank" }
end
end
end