summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-12 19:28:39 +0200
committerRémy Coutable <remy@rymai.me>2016-07-20 11:36:42 +0200
commit6b7e9c7655e4ffc74de90f01a0850a230b10a03c (patch)
treeda865eb7dff81588d426907afcc74d6a072fe3fa /lib
parent98e540532cc2706e4cdc027bd2acb8406e954ddc (diff)
downloadgitlab-ce-6b7e9c7655e4ffc74de90f01a0850a230b10a03c.tar.gz
Remove VideoJS and clean the integration
Handle videos in: - MD preview in notes: commit, issue/MR, MR diff - New notes in: commit, issue/MR, MR diff - Persisted notes in: commit, issue/MR, MR diff Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/video_link_filter.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/banzai/filter/video_link_filter.rb b/lib/banzai/filter/video_link_filter.rb
index 4dfbff8ec86..fd8b9a6f0cc 100644
--- a/lib/banzai/filter/video_link_filter.rb
+++ b/lib/banzai/filter/video_link_filter.rb
@@ -1,11 +1,10 @@
module Banzai
module Filter
- # HTML Filter that handles video uploads.
-
+ # Find every image that isn't already wrapped in an `a` tag, and that has
+ # a `src` attribute ending with a video extension, add a new video node and
+ # a "Download" link in the case the video cannot be played.
class VideoLinkFilter < HTML::Pipeline::Filter
- include ActionView::Helpers::TagHelper
- include ActionView::Context
def call
doc.xpath(query).each do |el|
@@ -27,8 +26,6 @@ module Banzai
end
end
- # Return a video tag Nokogiri node
- #
def video_node(doc, element)
container = doc.document.create_element(
'div',
@@ -38,16 +35,16 @@ module Banzai
video = doc.document.create_element(
'video',
src: element['src'],
- class: 'video-js vjs-sublime-skin',
+ width: '400',
controls: true,
- "data-setup": '{}')
+ 'data-setup' => '{}')
link = doc.document.create_element(
'a',
element['title'] || element['alt'],
href: element['src'],
target: '_blank',
- title: "Downlad '#{element['title'] || element['alt']}'")
+ title: "Download '#{element['title'] || element['alt']}'")
download_paragraph = doc.document.create_element('p')
download_paragraph.children = link