Class: Decidim::GeolocationController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Decidim::GeolocationController
- Includes:
- AjaxPermissionHandler
- Defined in:
- decidim-core/app/controllers/decidim/geolocation_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from Headers::HttpCachingDisabler
Methods included from HasStoredPath
#skip_store_location?, #store_current_location
Methods included from TranslatableAttributes
Methods included from RegistersPermissions
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#locate ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'decidim-core/app/controllers/decidim/geolocation_controller.rb', line 7 def locate :locate, :geolocation unless Decidim::Map.configured? return render(json: { message: I18n.t("not_configured", 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 |