Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure map icon URLs are correctly generated with fingerprints #5635

Merged
merged 6 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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') %>"
luisramos0 marked this conversation as resolved.
Show resolved Hide resolved
zoom: 12
additional_options:
# mapTypeId: 'satellite'
Expand Down
12 changes: 6 additions & 6 deletions app/serializers/api/enterprise_shopfront_list_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def path

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
Expand Down
10 changes: 10 additions & 0 deletions app/services/image_path_generator.rb
Original file line number Diff line number Diff line change
@@ -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