Files
openfoodnetwork/app/helpers/groups_helper.rb
2019-11-10 18:42:43 +00:00

23 lines
418 B
Ruby

module GroupsHelper
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 do
yield
end
end
def ext_url(prefix, url)
if url =~ %r{^https?://}i
url
else
prefix + url
end
end
def strip_url(url)
url.andand.sub(%r{^https?://}i, '')
end
end