Files
openfoodnetwork/app/serializers/api/open_street_map_config_serializer.rb
Cillian O'Ruanaidh c40697cf61 If no enterprises have been geocoded yet make sure Open Street Map still displays correctly.
Before it would display a gray/blank div instead of map because the map latitude, longitude couldn't be calculated without geocoded enterprises. This adds a setting so the default coordinates can be set even if no geocoded enterprises present.
2020-06-26 15:45:58 +01:00

32 lines
855 B
Ruby

# frozen_string_literal: true
module Api
class OpenStreetMapConfigSerializer < ActiveModel::Serializer
attributes :open_street_map_enabled,
:open_street_map_provider_name,
:open_street_map_provider_options,
:open_street_map_default_latitude,
:open_street_map_default_longitude
def open_street_map_enabled
ContentConfig.open_street_map_enabled
end
def open_street_map_provider_name
ContentConfig.open_street_map_provider_name
end
def open_street_map_provider_options
ContentConfig.open_street_map_provider_options.to_json
end
def open_street_map_default_latitude
ContentConfig.open_street_map_default_latitude
end
def open_street_map_default_longitude
ContentConfig.open_street_map_default_longitude
end
end
end