Module: ExternalLinkHelper

Includes:
ActionView::Helpers::TextHelper
Defined in:
app/helpers/external_link_helper.rb

Instance Method Summary collapse

Instance Method Details


6
7
8
9
10
11
# File 'app/helpers/external_link_helper.rb', line 6

def external_link(body, url, options = {})
  link = link_to url, { target: '_blank', rel: 'noopener noreferrer' }.merge(options) do
    "#{body}#{sprite_icon('external-link', css_class: 'gl-ml-2')}".html_safe
  end
  sanitize(link, tags: %w(a svg use), attributes: %w(target rel data-testid class href).concat(options.stringify_keys.keys))
end