Class: Decidim::Map::DynamicMap::Builder
- Inherits:
-
Frontend::Builder
- Object
- Frontend::Builder
- Decidim::Map::DynamicMap::Builder
- Defined in:
- lib/decidim/map/dynamic_map.rb
Overview
A builder for the dynamic maps to be used in the views. Provides all the necessary functionality to display and initialize the maps.
Direct Known Subclasses
Instance Method Summary collapse
- #append_assets ⇒ Object
-
#map_element(html_options = {}) ⇒ String
Displays the map element’s markup for the view.
Methods inherited from Frontend::Builder
Constructor Details
This class inherits a constructor from Decidim::Map::Frontend::Builder
Instance Method Details
#append_assets ⇒ Object
79 80 81 82 |
# File 'lib/decidim/map/dynamic_map.rb', line 79 def append_assets template.append_stylesheet_pack_tag("decidim_map") template.append_javascript_pack_tag("decidim_map_provider_default") end |
#map_element(html_options = {}) ⇒ String
Displays the map element’s markup for the view.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/decidim/map/dynamic_map.rb', line 63 def map_element( = {}) = { "data-decidim-map" => .to_json, # The data-markers-data is kept for backwards compatibility "data-markers-data" => .fetch(:markers, []).to_json }.merge() append_assets content = template.capture { yield }.html_safe if block_given? template.content_tag(:div, ) do (content || "") end end |