Sha256: 288e0d72658a03e75b06ade62cbcf89cc261acc60024c1dfc37a152ae3fe0553

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

<%
caption = component[:attributes].dig(:caption, :value)&.to_s&.html_safe
media_type = component[:attributes].dig(:media_type, :value)&.to_s
case media_type
when 'image'
  image_blob = blob_from_data component[:attributes][:image][:value]
when 'video'
  url = component[:attributes][: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 %> collection-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="collection-item__content__caption">
    <%= caption %>
  </div>
</div>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
promethee-4.1.15 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.14 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.13 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.12 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.11 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.10 app/views/promethee/components/collection_item/_show.html.erb