Skip to content

Commit

Permalink
Add artwork and rework how posters work
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Oct 30, 2024
1 parent 3a7f1f3 commit 387fc26
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 5 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/assets/images/events/default/poster.webp
Binary file not shown.
Binary file removed app/assets/images/posters/brighton_ruby.png
Binary file not shown.
Binary file removed app/assets/images/posters/fallback.png
Binary file not shown.
4 changes: 4 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def featured_image_path
event_image_or_default_for("featured.webp")
end

def poster_image_path
event_image_or_default_for("poster.webp")
end

def banner_background
static_metadata.banner_background.present? ? static_metadata.banner_background : "#FF607F"
rescue => _e
Expand Down
8 changes: 7 additions & 1 deletion app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def thumbnail_xl
end

def fallback_thumbnail
"/assets/#{Rails.application.assets.load_path.find("posters/fallback.png").digested_path}"
"/assets/#{Rails.application.assets.load_path.find("events/default/poster.webp").digested_path}"
end

def thumbnail(size = :thumbnail_lg)
Expand All @@ -179,11 +179,17 @@ def thumbnail(size = :thumbnail_lg)

if (asset = Rails.application.assets.load_path.find(self[size]))
return "/assets/#{asset.digested_path}"
elsif (asset = Rails.application.assets.load_path.find(event.poster_image_path))
return "/assets/#{asset.digested_path}"
else
return fallback_thumbnail
end
end

if (asset = Rails.application.assets.load_path.find(event.poster_image_path))
return "/assets/#{asset.digested_path}"
end

return fallback_thumbnail if video_provider != "youtube"

youtube = {
Expand Down
12 changes: 9 additions & 3 deletions data/brightonruby/playlists.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
- id: brightonruby-2023
title: Brighton Ruby 2023
description: 'Friday 30th June, 2023, Brighton Dome'
published_at: '2023-06-30'
location: "Brighton, UK"
description: "Friday 30th June, 2023, Brighton Dome"
published_at: "2023-06-30"
start_date: "2023-06-30"
end_date: "2023-06-30"
channel_id:
year: '2023'
year: "2023"
videos_count: 12
slug: brightonruby-2023
banner_background: "#FFFFFF"
featured_background: "#FFFBEB"
featured_color: "#0F1729"
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
end

Talk
.find_or_initialize_by(video_id: talk_data["video_id"], video_provider: :youtube)
.find_or_initialize_by(video_id: talk_data["video_id"], video_provider: talk_data["video_provider"] || :youtube)
.update_from_yml_metadata!(event: event)
rescue ActiveRecord::RecordInvalid => e
puts "Couldn't save: #{talk_data["title"]}, error: #{e.message}"
Expand Down

0 comments on commit 387fc26

Please sign in to comment.