Module: Decidim::Proposals::MapHelper

Includes:
ApplicationHelper
Included in:
ApplicationHelper
Defined in:
app/helpers/decidim/proposals/map_helper.rb

Overview

This helper include some methods for rendering proposals dynamic maps.

Instance Method Summary collapse

Instance Method Details

#has_position?(proposal) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'app/helpers/decidim/proposals/map_helper.rb', line 22

def has_position?(proposal)
  return if proposal.address.blank?

  proposal.latitude.present? && proposal.longitude.present?
end

#proposal_preview_data_for_map(proposal) ⇒ Object



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

def proposal_preview_data_for_map(proposal)
  {
    type: "drag-marker",
    marker: proposal.slice(
      :latitude,
      :longitude,
      :address
    ).merge(
      icon: icon("chat-new-line", width: 40, height: 70, remove_icon_class: true)
    )
  }
end