mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Merge pull request #5635 from Matt-Yorkley/map-icons
Ensure map icon URLs are correctly generated with fingerprints
This commit is contained in:
@@ -4,7 +4,7 @@ Darkswarm.factory "MapConfiguration", ->
|
||||
center:
|
||||
latitude: -37.4713077
|
||||
longitude: 144.7851531
|
||||
cluster_icon: 'assets/map_009-cluster.svg'
|
||||
cluster_icon: "<%= image_path('map_009-cluster.svg') %>"
|
||||
zoom: 12
|
||||
additional_options:
|
||||
# mapTypeId: 'satellite'
|
||||
@@ -13,13 +13,13 @@ module Api
|
||||
|
||||
def icon
|
||||
icons = {
|
||||
hub: "/assets/map_005-hub.svg",
|
||||
hub_profile: "/assets/map_006-hub-profile.svg",
|
||||
producer_hub: "/assets/map_005-hub.svg",
|
||||
producer_shop: "/assets/map_003-producer-shop.svg",
|
||||
producer: "/assets/map_001-producer-only.svg",
|
||||
hub: "map_005-hub.svg",
|
||||
hub_profile: "map_006-hub-profile.svg",
|
||||
producer_hub: "map_005-hub.svg",
|
||||
producer_shop: "map_003-producer-shop.svg",
|
||||
producer: "map_001-producer-only.svg",
|
||||
}
|
||||
icons[enterprise.category]
|
||||
ImagePathGenerator.call(icons[enterprise.category])
|
||||
end
|
||||
|
||||
def icon_font
|
||||
|
||||
10
app/services/image_path_generator.rb
Normal file
10
app/services/image_path_generator.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ImagePathGenerator
|
||||
# Since Rails 4 has adjusted the way assets paths are handled, we have to access certain
|
||||
# asset-based helpers like this when outside of a view or controller context.
|
||||
# See: https://stackoverflow.com/a/16609815
|
||||
def self.call(path)
|
||||
ActionController::Base.helpers.image_path(path)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user