From c0a3378d2587c9fda27e97645799dd7a008819a1 Mon Sep 17 00:00:00 2001 From: hellekin Date: Thu, 8 Oct 2020 17:38:04 +0200 Subject: Make map more beautiful This commit introduces a few things: 1. New `content_for` hooks for :debug, :head, and :body_end so that views code remains consistent and clean 2. Fullscreen map! 3. Welcome#index view, the Rails way It also moves controller-related code to the controller, Enjoy! --- app/views/welcome/index.html.erb | 53 ++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 32 deletions(-) (limited to 'app/views/welcome') diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 9873194..1977962 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -1,23 +1,26 @@ - - - - - - +<% content_for :head do %> + <%= stylesheet_link_tag("https://unpkg.com/leaflet@1.7.1/dist/leaflet.css", + integrity: "sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==", + crossorigin: '') %> + <%= javascript_include_tag("https://unpkg.com/leaflet@1.7.1/dist/leaflet.js", + integrity: "sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==", + crossorigin: '') %> +<% end %>

Bienvenue à l'atelier carto d'IN COMMON

-
-
+<%= tag.div(id: 'map') %> + +<% content_for :debug do %> +

Premier élément de la liste:

+ <% res = @resources.first %> +

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

+

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

+<% end %> + +<% content_for :body_end do %> -

Premier élément de la liste:

-

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

-

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

+<% end %> -- cgit v1.2.3