Sha256: 75394de4ec6b8794a2e8edae152743123504874764c8e554bd4bf85a0733411f

Contents?: true

Size: 953 Bytes

Versions: 8

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module MapComponent
      class MapController < DecidimAwesome::MapComponent::ApplicationController
        helper Decidim::DecidimAwesome::MapHelper
        helper_method :map_components

        def show
          render :error unless maps_enabled?
        end

        private

        def maps_enabled?
          return Decidim::Map.configured? if defined?(Decidim::Map)

          # TODO: remove when 0.22 support is diched
          Decidim.geocoder.present?
        end

        def map_components
          @map_components ||= current_participatory_space.components.published.filter do |component|
            case component.manifest.name
            when :meetings
              true
            when :proposals
              component.settings.geocoding_enabled
            else
              false
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.6.7 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.6 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.5 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.4 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.3 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.2 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.1 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
decidim-decidim_awesome-0.6.0 app/controllers/decidim/decidim_awesome/map_component/map_controller.rb