Sha256: a28ef01ce24eb98fb39a667258c084aec0265e5b5b10733e536c6e9699715f03

Contents?: true

Size: 952 Bytes

Versions: 16

Compression:

Stored size: 952 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

16 entries across 16 versions & 1 rubygems

Version Path
decidim-proposals-0.23.4 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.23.3 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.23.2 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.23.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.23.1.rc1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.23.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.22.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.21.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.20.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.20.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.19.1 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.19.0 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.14.4 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.14.3 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.14.2 app/helpers/decidim/proposals/map_helper.rb
decidim-proposals-0.14.1 app/helpers/decidim/proposals/map_helper.rb