aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/sections_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/sections_helper.rb')
-rw-r--r--app/helpers/sections_helper.rb15
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