Skip to content

Commit

Permalink
Fix bg images
Browse files Browse the repository at this point in the history
  • Loading branch information
Syntaf committed Nov 11, 2024
1 parent 53f3c69 commit 8ce463e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@ module ApplicationHelper
def development_mode?
Rails.env.development? && ActiveModel::Type::Boolean.new.cast(ENV['MOCK_WEATHER_DATA'])
end

def watched_area_bg_image
case @watched_area.slug
when 'redrock'
'media/images/redrock-winter-2020-hero.jpg'
when 'castlerock'
'media/images/castlerock/hero-image.jpg'
when 'stoneypoint'
'media/images/stoneypoint/hero-image.png'
end
end
end
2 changes: 1 addition & 1 deletion app/views/area/watched_area/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="hero-header <%= @watched_area.slug %>"
data-controller="async-image"
data-async-image-target="imageContainer"
data-async-image-image-url-value="<%= asset_pack_path('media/images/redrock-winter-2020-hero.jpg') %>"
data-async-image-image-url-value="<%= asset_pack_path(watched_area_bg_image) %>"
></div>
<div class="shadow-overlay"></div>

Expand Down

0 comments on commit 8ce463e

Please sign in to comment.