Module: Decidim::Votings::MapHelper

Includes:
LayoutHelper, SanitizeHelper
Included in:
VotingMapCell
Defined in:
app/helpers/decidim/votings/map_helper.rb

Overview

This helper include some methods for rendering votings dynamic maps.

Instance Method Summary collapse

Instance Method Details

#polling_station_data_for_map(polling_stations) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/decidim/votings/map_helper.rb', line 10

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