From c120ead3de7ee7be890b6c0218fa76a9127863e8 Mon Sep 17 00:00:00 2001 From: Nemael <100dragons@gmail.com> Date: Fri, 9 Oct 2020 00:54:02 +0200 Subject: Attempts to make buttons that update the leaflet map. The javascript functions and controllers functions are not in the correct files --- app/views/welcome/index.html.erb | 56 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 1977962..a07a034 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -6,16 +6,68 @@ integrity: "sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==", crossorigin: '') %> <% end %> +

Bienvenue à l'atelier carto d'IN COMMON

<%= tag.div(id: 'map') %> <% content_for :debug do %> + <%= def test_button + list_points = Resource.where('feature @> ?', {"properties": {"categories": [87]}}.to_json) + res_list = 0 + i = 0 + puts list_points + return(list_points) + end%>

Premier élément de la liste:

<% res = @resources.first %>

<%= res.feature["properties"]["name"] %>

<%= res.feature["geometry"]["coordinates"] %>

+ + <% x = Resource.where('feature @> ?', {"properties": {"categories": [87]}}.to_json)%> + <%= x[0].feature %> + <%= @number_fiel = number_field_tag("categories")%> + <%= "NUMBER FIELD:" + @number_fiel %> +

+ <%= x1 = Resource.where('feature @> ?', {"properties": {"categories": [@number_fiel]}}.to_json) %> + <%= "TEST" %> + <%= link_to("test_button", "", :onclick=> "update_leaflet(" + "[50.900, 4.351]" + ")", data: "ABC", remote: true)%> +

+ <%= categories = Category.order(:id)%> + <%= check_box_tag(categories[0].id, value="1", :onchange=>'alert()') %> +

+

+ <% categories.each do |category| %> + <%= x = check_box_tag("cat_sel", value=category.dewey_id, :onchange=> 'alert()') %> + + <%= puts x %> + <%= label_tag(category.name) %> + <% end %> + <%= link_to("Update Leaflet", "", :onclick=> "test_button()", remote: true)%> + <% end %> <% content_for :body_end do %> @@ -31,9 +83,5 @@ accessToken: 'pk.eyJ1IjoibmVtYWVsIiwiYSI6ImNrZzBrYjBudTB3bnMyenFmNWtrN3h3bmMifQ.Rkeyhm-9iIQOV7NAMA5LaA' }).addTo(mymap); var marker = L.marker([50.850, 4.351]).addTo(mymap); - //CONTINUER AVEC LES WHILE ET CONDITIONS, @resources ne contient que 25 elements (lié au nombre d'élément par page?) -- oui - //OU PLUTOT UTILISER POSTGRES POUR FAIRE DES REQUESTES SUR @resources - var count = 0 - console.log(count) <% end %> -- cgit v1.2.3