mmsc_app/app/views/public/video_files/_video_file.html.haml
Nicolas Bally a6aa1f6074 Initial
2020-05-25 11:40:11 +02:00

37 lines
2.0 KiB
Plaintext

-hard_link = hard_link || false
-if video_file
-video_file = video_file
-if video_file.image_file
-img_url = video_file.image_file.file.large.medium.small.url
-else
-img_url = ""
-css_style = "background-image:url('#{img_url}');background-size:100%;background-size:cover;background-position:center center;"
-if video_file and (video_file.youtube_code? or video_file.vimeo_code?)
-facebook_link = link_to "https://www.facebook.com/sharer/sharer.php?u=#{public_video_file_url(:slug => video_file.lang(@lang.slug).slug)}", :target => "_blank", :class => "link facebook", :onclick => "event.stopPropagation();" do
=i(:"facebook")
=#text=CSS%20Social%20Media%20Sidebar&
-twitter_link = link_to "https://twitter.com/intent/tweet?url=#{public_video_file_url(:slug => video_file.lang(@lang.slug).slug)}&via=onevoiceanimal", :target => "_blank", :class => "link twitter", :onclick => "event.stopPropagation();" do
=i(:"twitter")
=link_to public_video_file_url(:slug => video_file.lang(@lang.slug).slug), :onclick => ("return false;" if !hard_link) do
.video_thumb.with_ratio{:class => ("video_expand" if !hard_link).to_s, :style => css_style, :data => {:video_description => (video_file.lang(@lang.slug).description? ? simple_format(video_file.lang(@lang.slug).description) : ""),:video_title => (video_file.lang(@lang.slug).title? ? video_file.lang(@lang.slug).title : video_file.lang("fr").title ), :facebook_link => facebook_link, :twitter_link => twitter_link, :ratio => "0.62",:video_type => (video_file.youtube_code? ? "youtube" : "vimeo"), :video_url => (video_file.youtube_code? ? 'https://www.youtube.com/embed/'+video_file.youtube_code+'?autoplay=1&rel=0' : 'https://player.vimeo.com/video/'+video_file.vimeo_code+'?autoplay=1')}}
.overlay
.gradient
.play_button=ic(:"play-circle")
%h4.title
= (video_file.lang(@lang.slug).title? ? video_file.lang(@lang.slug).title : video_file.lang("fr").title )