Sha256: 5ded2c4aa082f3c652b6f60c0d9c29b83355cfe3a06b6b074980f5ed32dca22d

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

<%
media_type = component[:attributes].dig(:media_type, :value)
caption = component[:attributes].dig(:caption, :value)&.to_s&.html_safe
case media_type
when 'image'
  image_blob = blob_from_data component[:attributes].dig(:image, :value)
when 'video'
  url = component[:attributes].dig(:video, :value)&.to_s
  if 'vimeo'.in? url
    video_id = url.gsub(/\A(?:https?:)?\/\/(?:(?:www|player)\.)?vimeo\.com\/(?:video\/)?(\d+).*?\z/, '\1')
    iframe_src = "https://player.vimeo.com/video/#{video_id}?color=ffffff&title=0&byline=0&portrait=0"
  elsif 'youtube'.in? url
    video_id = url.split('watch?v=').last
    iframe_src = "https://www.youtube.com/embed/#{video_id}"
  else
    iframe_src = url
  end
end
%>
<div class="<%= promethee_class_for component %> carousel-item__content"
     id="<%= promethee_id_for component %>">
  <% if iframe_src.present? %>
  <div class="embed-responsive embed-responsive-16by9">
    <iframe frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" src="<%= iframe_src %>"></iframe>
  </div>
  <% elsif image_blob.present? %>
    <%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption %>
  <% end %>
  <div class="carousel-item__content__caption">
    <%= caption %>
  </div>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
promethee-4.1.10 app/views/promethee/components/slider_item/_show.html.erb