Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change map to use OSM #367

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
cinPlaylistID = "PLsxUDJzU4VKAAH1pOogbzJx7pZgd-2zOx"
channelURL = "//youtube.com/ury1350"

[pageContext.gmaps]
APIKey = "AIzaSyACeeyIgdIhiSxV01OIPiA3MyJDqrOspLQ"
[pageContext.osm]
latitude = 53.948193
longitude = -1.054030

Expand Down
45 changes: 7 additions & 38 deletions public/js/responsivemap.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
/*global google:true placeName*/

$(document).ready(function () {
//Google Maps JS
//Set Map
function initialize() {
var uryLocation = new google.maps.LatLng(Lat, Lng);
var mapOptions = {
zoom: 15,
center: uryLocation
};

var map = new google.maps.Map(document.getElementById("map"), mapOptions);
//Callout Content
var contentString = placeName;
//Set window width + content
var infowindow = new google.maps.InfoWindow({
content: contentString,
maxWidth: 500
});

//Add Marker
var marker = new google.maps.Marker({
position: uryLocation,
map,
title: placeName
});

//Resize Function
google.maps.event.addDomListener(window, "resize", function () {
var center = map.getCenter();
google.maps.event.trigger(map, "resize");
map.setCenter(center);
});
}

google.maps.event.addDomListener(window, "load", initialize);
});
var map = L.map('map').setView([Lat, Lng], 15);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var marker = L.marker([Lat, Lng]).addTo(map);
marker.bindPopup("University Radio York").openPopup();
5 changes: 2 additions & 3 deletions structs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type PageContext struct {
CacheBuster string `toml:"cacheBuster"`
Pages []Page
Youtube youtube
Gmaps gmaps
Osm osm
CurrentYear int
}

Expand Down Expand Up @@ -99,8 +99,7 @@ type youtube struct {
ChannelURL string `toml:"channelURL"`
}

type gmaps struct {
APIKey string `toml:"apiKey"`
type osm struct {
Lat float32 `toml:"latitude"`
Lng float32 `toml:"longitude"`
}
Expand Down
5 changes: 4 additions & 1 deletion views/cin.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{define "title"}}{{.PageContext.ShortName}} | Candidate Interview Night{{end}}

{{define "content"}}
{{define "head"}}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
{{end}}

{{define "content"}}
<div class="container-fluid bg-cin-2">
<div class="container bg-cin bg-cin-space">
<div class="container container-padded">
Expand Down
13 changes: 10 additions & 3 deletions views/contact.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<meta property="og:image" content="{{.PageContext.FullURL}}{{url "/images/open_graph-general.jpg"}}">
<meta property="og:url" content="{{.PageContext.FullURL}}{{url "/contact/"}}">
{{end}}
{{define "head"}}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
{{end}}

{{define "content"}}
<div class="container-fluid banner-2 text-overlay">
Expand Down Expand Up @@ -142,9 +147,11 @@
<!-- Responsive map script -->
<script>
var placeName = "{{.PageContext.LongName}}";
var Lat = {{.PageContext.Gmaps.Lat}};
var Lng = {{.PageContext.Gmaps.Lng}};
var Lat = {{.PageContext.Osm.Lat}};
var Lng = {{.PageContext.Osm.Lng}};
</script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script src='{{url "/js/responsivemap.js"}}?ver={{ .PageContext.CacheBuster }}'></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key={{.PageContext.Gmaps.APIKey}}"></script>
{{end}}
5 changes: 4 additions & 1 deletion views/partials/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta name="description" content="{{.PageContext.SiteDescription}}">

<title>{{block "title" .}}{{.PageContext.LongName}}{{end}}</title>

{{block "open-graph" .}}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@{{.PageContext.MainTwitter}}">
Expand All @@ -27,6 +27,9 @@
<meta property="og:url" content='{{.PageContext.FullURL}}{{url "/"}}'>
{{end}}

{{block "head" .}}
{{end}}

<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
<!-- bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
Expand Down
7 changes: 5 additions & 2 deletions views/podcast_player.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<meta property="og:description" content="{{ stripHtml .PageData.Podcast.Description}}">
{{end}}

{{define "head"}}
<link rel="stylesheet" href='{{url "/css/podcast_player.css"}}'>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway:400,500">
{{end}}

{{define "content"}}

{{with .PageData}}
Expand Down Expand Up @@ -87,7 +92,5 @@
});

</script>
<link rel="stylesheet" href='{{url "/css/podcast_player.css"}}'>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway:400,500">
{{end}}
{{end}}
4 changes: 3 additions & 1 deletion views/show.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<meta property="og:url" content='{{.PageContext.FullURL}}{{url "/schedule/shows/"}}{{.PageData.Show.ShowID}}'>
<meta property="og:description" content="{{ stripHtml .PageData.Show.Description}}">
{{end}}
{{define "head"}}
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css">
{{end}}

{{define "content"}}
<div class="container-fluid current-next">
Expand Down Expand Up @@ -241,7 +244,6 @@
{{end}}
{{end}}
{{define "footer-scripts"}}
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.18/css/dataTables.bootstrap4.min.css">
<script src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="//cdn.datatables.net/1.10.18/js/dataTables.bootstrap4.min.js"></script>
<script src="//cdn.datatables.net/plug-ins/1.10.16/api/fnFindCellRowIndexes.js"></script>
Expand Down