Sha256: a727e715f75715ae14dfc4f804fb63a6ee20b104f736ee14501ae7ea5ee85d5d

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 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: '', title: '', caption: caption %>
  <% end %>
  <div class="collection-item__content__caption">
    <%= caption %>
  </div>
</div>

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
promethee-4.1.28 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.27 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.26 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.25 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.24 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.23 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.22 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.21 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.20 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.19 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.18 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.17 app/views/promethee/components/collection_item/_show.html.erb
promethee-4.1.16 app/views/promethee/components/collection_item/_show.html.erb