mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
19 lines
372 B
Ruby
19 lines
372 B
Ruby
# frozen_string_literal: true
|
|
|
|
module LinkHelper
|
|
def link_to_service(baseurl, name, html_options = {}, &block)
|
|
return if name.blank?
|
|
|
|
html_options = html_options.merge target: '_blank'
|
|
link_to ext_url(baseurl, name), html_options, &block
|
|
end
|
|
|
|
def ext_url(prefix, url)
|
|
if url =~ %r{^https?://}i
|
|
url
|
|
else
|
|
prefix + url
|
|
end
|
|
end
|
|
end
|