Skip to content

Commit

Permalink
Fix map after splitting ciphers into normal, mini and simple types
Browse files Browse the repository at this point in the history
  • Loading branch information
setnicka committed Sep 27, 2022
1 parent 8b8889f commit 5eac0cf
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
7 changes: 7 additions & 0 deletions static/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ if (typeof L !== 'undefined') {
var cipherIcon = L.ExtraMarkers.icon({
icon: 'fa-file',
shape: 'penta',
markerColor: 'red',
svg: true,
prefix: 'fa'
});
var simpleIcon = L.ExtraMarkers.icon({
icon: 'fa-question-circle-o',
shape: 'circle',
markerColor: 'yellow',
svg: true,
prefix: 'fa'
Expand Down
24 changes: 23 additions & 1 deletion templates/org/org_index_map.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ L.tileLayer('https://m{s}.mapserver.mapy.cz/turist-m/{z}-{x}-{y}', {
subdomains: "1234",
}).addTo(map);

{{ range .Ciphers }}
{{ range .Ciphers.Ciphers }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.circle({{ .Position.Point | latlon }}, {
color: 'yellow',
fillColor: '#fbff94',
Expand All @@ -38,6 +39,27 @@ L.tileLayer('https://m{s}.mapserver.mapy.cz/turist-m/{z}-{x}-{y}', {
icon: cipherIcon,
}).addTo(map).on('click', function() {highlightCipher("{{ .ID }}")});
{{ end }}
{{ range .Ciphers.MiniCiphers }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.circle({{ .Position.Point | latlon }}, {
color: 'yellow',
fillColor: '#fbff94',
fillOpacity: 0.5,
radius: {{ .Position.Radius }}
}).addTo(map);

L.marker({{ .Position.Point | latlon }}, {
title: "{{ .Name }}",
icon: cipherIcon,
}).addTo(map).on('click', function() {highlightCipher("{{ .ID }}")});
{{ end }}
{{ range .Ciphers.Simple }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.marker({{ .Position.Point | latlon }}, {
title: "{{ .Name }}",
icon: simpleIcon,
}).addTo(map);
{{ end }}

var displayedPath;
function showPath(id) {
Expand Down
24 changes: 23 additions & 1 deletion templates/org/org_playback.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ L.tileLayer('https://m{s}.mapserver.mapy.cz/turist-m/{z}-{x}-{y}', {
subdomains: "1234",
}).addTo(map);

{{ range .Ciphers }}
{{ range .Ciphers.Ciphers }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.circle({{ .Position.Point | latlon }}, {
color: 'yellow',
fillColor: '#fbff94',
Expand All @@ -37,6 +38,27 @@ L.tileLayer('https://m{s}.mapserver.mapy.cz/turist-m/{z}-{x}-{y}', {
L.marker({{ .Position.Point | latlon }}, {
title: "{{ .Name }}",
icon: cipherIcon,
}).addTo(map).on('click', function() {highlightCipher("{{ .ID }}")});
{{ end }}
{{ range .Ciphers.MiniCiphers }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.circle({{ .Position.Point | latlon }}, {
color: 'yellow',
fillColor: '#fbff94',
fillOpacity: 0.5,
radius: {{ .Position.Radius }}
}).addTo(map);

L.marker({{ .Position.Point | latlon }}, {
title: "{{ .Name }}",
icon: cipherIcon,
}).addTo(map).on('click', function() {highlightCipher("{{ .ID }}")});
{{ end }}
{{ range .Ciphers.Simple }}
{{ if .Position.Point.IsZero }}{{ continue }}{{ end }}
L.marker({{ .Position.Point | latlon }}, {
title: "{{ .Name }}",
icon: simpleIcon,
}).addTo(map);
{{ end }}

Expand Down

0 comments on commit 5eac0cf

Please sign in to comment.