mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-01 16:46:16 +00:00
13 lines
460 B
Ruby
13 lines
460 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ExternalLinkHelper
|
|
include ActionView::Helpers::TextHelper
|
|
|
|
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
|
|
end
|