related tags: strip http:// from artist urls.
This commit is contained in:
@@ -107,12 +107,10 @@ module ApplicationHelper
|
||||
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
|
||||
end
|
||||
|
||||
def external_link_to(url, options = {})
|
||||
if options[:truncate]
|
||||
text = truncate(url, length: options[:truncate])
|
||||
else
|
||||
text = url
|
||||
end
|
||||
def external_link_to(url, truncate: nil, strip_scheme: false)
|
||||
text = url
|
||||
text = text.gsub(%r!\Ahttps?://!i, "") if strip_scheme
|
||||
text = text.truncate(truncate) if truncate
|
||||
|
||||
if url =~ %r!\Ahttps?://!i
|
||||
link_to text, url, {rel: :nofollow}
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<% artist.sorted_urls.each do |url| %>
|
||||
<li>
|
||||
<% if url.is_active %>
|
||||
<%= external_link_to url.url, truncate: 30 %>
|
||||
<%= external_link_to url.url, truncate: 64, strip_scheme: true %>
|
||||
<%= link_to tag.i(class: "fas fa-minus-circle"), artist_url_path(id: url.id, artist_url: { is_active: false }), remote: true, method: :put, "data-confirm": "This will mark the URL as inactive. Continue?" %>
|
||||
<% else %>
|
||||
<del><%= truncate(url.url, length: 30) %></del>
|
||||
<del><%= external_link_to url.url, truncate: 64, strip_scheme: true %></del>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user