aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-02-07 14:31:05 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-02-07 14:39:54 +0100
commit85ca3d263cae412d792dfe48fb0de2bc7652000e (patch)
tree1fa207a1f7d7773ead18b48bbf48f308b1040140
parente2b47406f8dfa0764ecad89e99319025cb7d8278 (diff)
add map on homepage
-rw-r--r--Makefile8
-rw-r--r--layouts/_default/baseof.html1
-rw-r--r--layouts/index.html10
-rw-r--r--package-lock.json5
-rw-r--r--package.json1
-rw-r--r--static/css/fournil.css4
-rw-r--r--static/js/fournil-map.js21
7 files changed, 49 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index bafb01d..7782062 100644
--- a/Makefile
+++ b/Makefile
@@ -3,21 +3,27 @@ PATH := node_modules/.bin:$(PATH)
STATIC=./static
DIST_STATIC=./dist/static
-build: npm css fonts img site
+build: npm css js fonts img site
npm:
npm install
css:
mkdir -p $(DIST_STATIC)/css && cp node_modules/bootstrap/dist/css/bootstrap.min.css $(DIST_STATIC)/css/
+ cp node_modules/leaflet/dist/leaflet.css $(DIST_STATIC)/css/
cp $(STATIC)/css/* $(DIST_STATIC)/css
+js:
+ mkdir -p $(DIST_STATIC)/js && cp node_modules/leaflet/dist/leaflet.js $(DIST_STATIC)/js/
+ cp $(STATIC)/js/* $(DIST_STATIC)/js
+
fonts:
mkdir -p $(DIST_STATIC)/fonts && cp -R node_modules/font-awesome/fonts/* $(DIST_STATIC)/fonts/
mkdir -p $(DIST_STATIC)/css && cp -R node_modules/font-awesome/css/font-awesome.min.css $(DIST_STATIC)/css/
img:
mkdir -p $(DIST_STATIC)/img && cp $(STATIC)/img/* $(DIST_STATIC)/img
+ cp node_modules/leaflet/dist/images/* $(DIST_STATIC)/img
site:
hugo
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index b8f7b33..15e3b00 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -4,6 +4,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>{{ block "title" . }}{{ .Site.Title }} - {{ .Title }}{{ end }}</title>
+ {{ block "head" . }}{{ end }}
<link href="{{ .Site.BaseURL }}css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{ .Site.BaseURL }}css/fournil.css" rel="stylesheet" type="text/css">
</head>
diff --git a/layouts/index.html b/layouts/index.html
index 2085ea5..fc58653 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,3 +1,12 @@
+{{ define "head" }}
+<link href="{{ .Site.BaseURL }}css/leaflet.css" rel="stylesheet" type="text/css">
+{{ end }}
+
+{{ define "footer" }}
+<script src="{{ .Site.BaseURL }}js/leaflet.js"></script>
+<script src="{{ .Site.BaseURL }}js/fournil-map.js"></script>
+{{ end }}
+
{{ define "header" }}
<div class="header">
<div class="logo">
@@ -21,6 +30,7 @@
<div class="container-fluid">
<div class="vertical-align">
<div class="banner">
+ <div id="fournilmap"></div>
{{ .Content }}
</div>
</div>
diff --git a/package-lock.json b/package-lock.json
index db44f4b..0c20568 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24,6 +24,11 @@
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
"integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
},
+ "leaflet": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.3.1.tgz",
+ "integrity": "sha512-adQOIzh+bfdridLM1xIgJ9VnJbAUY3wqs/ueF+ITla+PLQ1z47USdBKUf+iD9FuUA8RtlT6j6hZBfZoA6mW+XQ=="
+ },
"popper.js": {
"version": "1.12.9",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.12.9.tgz",
diff --git a/package.json b/package.json
index 3d1d7e6..411d4ce 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"bootstrap": "^4.0.0",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
+ "leaflet": "^1.3.1",
"popper.js": "^1.12.9",
"uglify-js": "^3.3.8"
},
diff --git a/static/css/fournil.css b/static/css/fournil.css
index 2fafe55..b69d455 100644
--- a/static/css/fournil.css
+++ b/static/css/fournil.css
@@ -45,3 +45,7 @@ body {
.header nav {
}
+
+#fournilmap {
+ height: 300px;
+}
diff --git a/static/js/fournil-map.js b/static/js/fournil-map.js
new file mode 100644
index 0000000..6c795b2
--- /dev/null
+++ b/static/js/fournil-map.js
@@ -0,0 +1,21 @@
+var longitude = 49.109872;
+var latitude = 1.595067;
+
+var map = L.map('fournilmap').setView([longitude, latitude], 12);
+
+L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
+ maxZoom: 18,
+}).addTo(map);
+
+var breadIcon = L.icon ({
+ iconUrl: '/img/marker-icon.png',
+ shadowUrl: '/img/marker-shadow.png',
+ iconSize: [25, 41],
+ iconAnchor: [12, 41],
+ popupAnchor: [1, -34],
+ tooltipAnchor: [16, -28],
+ shadowSize: [41, 41]
+});
+
+L.marker([longitude, latitude], {icon: breadIcon}).addTo(map);