Merge pull request #5635 from Matt-Yorkley/map-icons

Ensure map icon URLs are correctly generated with fingerprints
This commit is contained in:
Luis Ramos
2020-06-18 18:02:47 +01:00
committed by GitHub
3 changed files with 17 additions and 7 deletions

View File

@@ -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'

View File

@@ -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

View 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