9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/decidim/reporting_proposals/geolocation_controller.rb', line 9
def locate
enforce_permission_to :locate, :geolocation
unless Decidim::Map.configured?
return render(json: { message: I18n.t("unconfigured", scope: "decidim.application.geocoding"), found: false }, status: :unprocessable_entity)
end
geocoder = Decidim::Map.utility(:geocoding, organization: current_organization)
address = geocoder.address([params[:latitude], params[:longitude]])
render json: { address:, found: address.present? }
end
|