aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/map_helper.rb
blob: 8fadff8146a0c98a7d1f42fd04a2d4bd39432f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

module MapHelper
  def map_container(map = Map.first)
    return unless map # Fixes a case where there are no maps
    raw tag.div(
          tag.div(id: 'map',
                  data: {
                    target: 'map.container'
                  }),
          data: {
            controller: 'map',
            'map-latitude': map.latitude,
                 'map-longitude': map.longitude,
                 'map-zoom': map.zoom
          })
  end
end