Sha256: 16e6bb42bff0ef0dd8f2db9c0c206c46d2a89f25fc5f941719efd4cf7fff7b43

Contents?: true

Size: 1.2 KB

Versions: 97

Compression:

Stored size: 1.2 KB

Contents

<%
media_type = component[:attributes][:media_type]
searchable_caption = component[:attributes][:searchable_caption]
case media_type
when 'image'
  image_data = component[:attributes][:image]
  if image_data && image_data[:id]
    image_blob = ActiveStorage::Blob.find image_data[:id]
  end
when 'video'
  url = component[:attributes][:video][:url].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 = "http://www.youtube.com/embed/#{video_id}"
  else
    iframe_src = url
  end
end
%>
<div class="carousel-item__content">

  <% 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: searchable_caption %>
  <% end %>
  <%= searchable_caption.to_s.html_safe %>
</div>

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
promethee-2.0.7 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.6 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.5 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.4 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.3 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.2 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.1 app/views/promethee/components/slider_item/_show.html.erb
promethee-2.0.0 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.29 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.28 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.27 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.26 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.25 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.24 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.23 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.22 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.21 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.20 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.19 app/views/promethee/components/slider_item/_show.html.erb
promethee-1.11.18 app/views/promethee/components/slider_item/_show.html.erb