Mark links in notes and fetch source data box as external.

This commit is contained in:
evazion
2019-10-13 18:53:46 -05:00
parent 7ebf6ed9d7
commit 07116d1445
4 changed files with 7 additions and 8 deletions

View File

@@ -78,8 +78,7 @@ module ApplicationHelper
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
end
def external_link_to(url, truncate: nil, strip: false, **link_options)
text = url
def external_link_to(url, text = url, truncate: nil, strip: false, **link_options)
text = text.gsub(%r!\Ahttps?://!i, "") if strip == :scheme
text = text.gsub(%r!\Ahttps?://(?:www\.)?!i, "") if strip == :subdomain
text = text.truncate(truncate) if truncate