diff --git a/app/assets/javascripts/darkswarm/services/map_configuration.js.coffee b/app/assets/javascripts/darkswarm/services/map_configuration.js.erb.coffee similarity index 95% rename from app/assets/javascripts/darkswarm/services/map_configuration.js.coffee rename to app/assets/javascripts/darkswarm/services/map_configuration.js.erb.coffee index 93e4104f0a..61598c414c 100644 --- a/app/assets/javascripts/darkswarm/services/map_configuration.js.coffee +++ b/app/assets/javascripts/darkswarm/services/map_configuration.js.erb.coffee @@ -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' diff --git a/app/serializers/api/enterprise_shopfront_list_serializer.rb b/app/serializers/api/enterprise_shopfront_list_serializer.rb index dd83ce4323..0dccfaa1c2 100644 --- a/app/serializers/api/enterprise_shopfront_list_serializer.rb +++ b/app/serializers/api/enterprise_shopfront_list_serializer.rb @@ -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 diff --git a/app/services/image_path_generator.rb b/app/services/image_path_generator.rb new file mode 100644 index 0000000000..48c9ee93d1 --- /dev/null +++ b/app/services/image_path_generator.rb @@ -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