cartodb-4.42/app/models/carto/helpers/google_maps.rb

24 lines
627 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
module Carto::GoogleMaps
def google_maps_api_key
organization&.google_maps_key.presence || google_maps_key
end
alias_method :google_maps_query_string, :google_maps_api_key
def google_maps_geocoder_enabled?
google_maps_private_key.present? && google_maps_client_id.present?
end
def google_maps_client_id
Rack::Utils.parse_nested_query(google_maps_query_string)['client'] if google_maps_query_string
end
def basemaps
(Cartodb.config[:basemaps] || []).select { |group| group != 'GMaps' || google_maps_enabled? }
end
def google_maps_enabled?
google_maps_query_string.present?
end
end