Sha256: 7380c6180a3e948805a8ec6c03030d01c244f6e0b5acd717e7a3364c8256c372

Contents?: true

Size: 789 Bytes

Versions: 7

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Votings
    # This helper include some methods for rendering votings dynamic maps.
    module MapHelper
      include Decidim::SanitizeHelper
      include Decidim::LayoutHelper

      def polling_station_data_for_map(polling_stations)
        polling_stations_geocoded = polling_stations.select(&:geocoded_and_valid?)
        polling_stations_geocoded.map do |polling_station|
          polling_station.slice(:latitude, :longitude, :address)
                         .merge(
                           title: translated_attribute(polling_station.title),
                           items: [{ icon: icon("map-line").html_safe, text: polling_station.address }].to_json
                         )
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.3 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.2 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.1 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.0 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.0.rc5 app/helpers/decidim/votings/map_helper.rb
decidim-elections-0.28.0.rc4 app/helpers/decidim/votings/map_helper.rb