Module: Decidim::Meetings::MapHelper

Includes:
SanitizeHelper
Included in:
ApplicationHelper, Directory::ApplicationHelper, MeetingsMapCell
Defined in:
app/helpers/decidim/meetings/map_helper.rb

Overview

This helper include some methods for rendering meetings dynamic maps.

Instance Method Summary collapse

Instance Method Details

#meetings_data_for_map(meetings) ⇒ Object

Serialize a collection of geocoded meetings to be used by the dynamic map component

meetings - A collection of meetings



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

def meetings_data_for_map(meetings)
  geocoded_meetings = meetings.select(&:geocoded_and_valid?)
  geocoded_meetings.map do |meeting|
    meeting.slice(:latitude, :longitude, :address).merge(title: translated_attribute(meeting.title),
                                                         link: resource_locator(meeting).path,
                                                         items: cell("decidim/meetings/meeting_card_metadata", meeting).send(:meeting_items_for_map).to_json)
  end
end