From b54a8458d5029b3494165b7430e21b3ae34ecc0c Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 22 Jan 2021 05:32:15 +0100 Subject: Upgrade Rails and add StimulusJS support --- app/views/sections/show.html.erb | 11 +++++++++++ app/views/sections/show.json.erb | 1 + 2 files changed, 12 insertions(+) create mode 100644 app/views/sections/show.html.erb create mode 100644 app/views/sections/show.json.erb (limited to 'app/views/sections') diff --git a/app/views/sections/show.html.erb b/app/views/sections/show.html.erb new file mode 100644 index 0000000..9a69891 --- /dev/null +++ b/app/views/sections/show.html.erb @@ -0,0 +1,11 @@ +

+// First, create a section layer on the map, then assign all resource markers to it.
+sec<%= @section.id %> = L.layerGroup
+
+<% @section.resources.each_with_index do |res, i| %>
+mk_<%= i %> = L.marker([<%= res.latitude %>, <%= res.longitude %>]).addTo(sec<%= @section.id %>)
+<% end %>
+
+sec<%= @section.id %>.addTo(map)
+
+
diff --git a/app/views/sections/show.json.erb b/app/views/sections/show.json.erb new file mode 100644 index 0000000..9520404 --- /dev/null +++ b/app/views/sections/show.json.erb @@ -0,0 +1 @@ +<%= geojson_feature_collection(@section) %> -- cgit v1.2.3