Skip to content

Commit

Permalink
Only show videos with valid thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed May 18, 2022
1 parent 5345423 commit a9de7d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/video.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ def thumbnail
"https://img.youtube.com/vi/#{key}/hqdefault.jpg"
end
end

def thumbnail?
thumbnail.present?
end
end
2 changes: 1 addition & 1 deletion app/views/admin/shared/_media.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h3>Videos</h3>

<ul class="media-grid" data-behavior="video-gallery">
<% instance.videos.each do |video| %>
<% instance.videos.select(&:thumbnail?).each do |video| %>
<li>
<figure class="fill zoom aspect-ratio-16x9">
<%= link_to image_tag(video.thumbnail), video.url %>
Expand Down

0 comments on commit a9de7d7

Please sign in to comment.