Sha256: a1cc1823af0fd899351ef6ea2fe812fdab2d60ff67d1da5222a0c8904efc2e0e

Contents?: true

Size: 953 Bytes

Versions: 10

Compression:

Stored size: 953 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    # This helper include some methods for rendering proposals dynamic maps.
    module MapHelper
      include Decidim::ApplicationHelper
      # Serialize a collection of geocoded proposals to be used by the dynamic map component
      #
      # geocoded_proposals - A collection of geocoded proposals
      def proposals_data_for_map(geocoded_proposals)
        geocoded_proposals.map do |proposal|
          proposal.slice(:latitude, :longitude, :address).merge(title:  present(proposal).title,
                                                                body: truncate(present(proposal).body, length: 100),
                                                                icon: icon("proposals", width: 40, height: 70, remove_icon_class: true),
                                                                link: proposal_path(proposal))
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-proposals-0.18.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.17.2 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.18.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.17.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.16.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.17.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.16.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.15.2 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.15.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.15.0 app/helpers/decidim/proposals/map_helper.rb