mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
UX: show Vimeo links in embedded comments
This commit is contained in:
parent
f6c6f6e7a1
commit
5fd6c693d0
1 changed files with 7 additions and 0 deletions
|
@ -22,6 +22,13 @@ module EmbedHelper
|
|||
youtube_link = "https://www.youtube.com/watch?v=#{youtube_id}"
|
||||
yt_div.replace "<p><a href='#{youtube_link}'>#{youtube_link}</a></p>"
|
||||
end
|
||||
# convert Vimeo iframe to link
|
||||
fragment.css('iframe').each do |iframe|
|
||||
if iframe['src'] =~ /player.vimeo.com/
|
||||
vimeo_id = iframe['src'].split('/').last
|
||||
iframe.replace "<p><a href='https://vimeo.com/#{vimeo_id}'>https://vimeo.com/#{vimeo_id}</a></p>"
|
||||
end
|
||||
end
|
||||
raw fragment
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue