aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/sections_helper.rb
blob: 83efa40d78f8e0b7d27b73ff26efc11a161f5901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# SPDX-FileCopyrightText: 2021 IN COMMON Collective
#
# SPDX-License-Identifier: AGPL-3.0-or-later

module SectionsHelper
  # Render a section as a GeoJSON FeatureCollection
  def geojson_feature_collection(section)
    features = section.resources.map { |res| json_marker_for(res, section) }.join(',')

    raw("{ \"type\": \"FeatureCollection\", \"features\": [ #{features} ] }")
  end
end