Module: RedminePluginKit::Helpers::GlobalHelper
- Defined in:
- lib/redmine_plugin_kit/helpers/global_helper.rb
Instance Method Summary collapse
Instance Method Details
#link_to_external(name, link, **options) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/redmine_plugin_kit/helpers/global_helper.rb', line 6 def link_to_external(name, link, **) [:class] ||= 'external' [:class] = "#{[:class]} external" if [:class].exclude? 'external' [:rel] ||= 'noopener noreferrer' link_to name, link, ** end |
#link_to_url(url, **options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/redmine_plugin_kit/helpers/global_helper.rb', line 14 def link_to_url(url, **) return if url.blank? parts = url.split '://' name = if parts.count.positive? parts.shift parts.join.chomp '/' else url.chomp '/' end link_to_external name, url, ** end |