diff options
author | hellekin <hellekin@cepheide.org> | 2021-01-22 10:35:07 +0100 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2021-01-22 10:35:07 +0100 |
commit | 97bfc3f6012027077077ea4a6b5f2f709c76158e (patch) | |
tree | 51df0783d3c8ce8b2e928c73d28a77fffb417dbb /app/helpers/sections_helper.rb | |
parent | bf087e092cc60defb307f4625333c97327283cc3 (diff) | |
download | incommon-map-97bfc3f6012027077077ea4a6b5f2f709c76158e.tar.gz |
Add markers and popups
- Replace MakiMarkers with ExtraMarkers and ForkAwesome
- Add HTML popup binding
Diffstat (limited to 'app/helpers/sections_helper.rb')
-rw-r--r-- | app/helpers/sections_helper.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/app/helpers/sections_helper.rb b/app/helpers/sections_helper.rb index 8180fee..20f602b 100644 --- a/app/helpers/sections_helper.rb +++ b/app/helpers/sections_helper.rb @@ -1,19 +1,8 @@ module SectionsHelper # Render a section as a GeoJSON FeatureCollection def geojson_feature_collection(section) - out = [] - class_name = { baseVal: "cat#{section.category_id} sec#{section.id}" } - style = { fill: section.category.color } + features = section.resources.map { |res| json_marker_for(res, section) }.join(',') - section.resources.each do |marker| - # Add styling - marker = marker.to_geojson - marker['className'] = class_name - marker['style'] = style - - out << marker.to_json - end - - raw("{ \"type\": \"FeatureCollection\", \"features\": [ #{out.join(',')} ] }") + raw("{ \"type\": \"FeatureCollection\", \"features\": [ #{features} ] }") end end |