Skip to content

Commit

Permalink
updating, added custom submit form
Browse files Browse the repository at this point in the history
  • Loading branch information
d3netxer committed Sep 1, 2023
1 parent ad11971 commit f1ae903
Show file tree
Hide file tree
Showing 11 changed files with 1,466 additions and 44 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.DS_Store
~
_site/
.jekyll-cache
.jekyll-cache/
.jekyll-cache/*
test/
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
baseurl: ''
#exclude: [src, CNAME, "2012", "2013"]
#markdown: kramdown
api: 'https://script.google.com/macros/s/AKfycbxqU4I_53-7iFrC88cO9pSYupPVxjs83Mi5uXIB8ilSTMXjkLrtXmu0QcApZh2NfQky/exec'

future: true

Expand Down
56 changes: 35 additions & 21 deletions _includes/map.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="map" style="min-height: 350px;"></div>

<script>
L.mapbox.accessToken = 'pk.eyJ1IjoiaGl1IiwiYSI6InJWNGZJSzgifQ.xK1ndT3W8XL9lwVZrT6jvQ';
L.mapbox.accessToken = 'pk.eyJ1IjoidGdlcnRpbiIsImEiOiJYTW5sTVhRIn0.X4B5APkxkWVaiSg3KqMCaQ';
var map = L.mapbox.map('map', null, { infoControl: false, attributionControl: true, minZoom: 2,
maxZoom: 16, scrollWheelZoom: false });
// map.attributionControl.setPrefix('');
Expand All @@ -13,29 +13,43 @@
// attribution: '<a href="http://osm.org/copyright">&copy; OpenStreetMap contributors</a>'
// }).addTo(map);

var tileURL = L.Browser.retina ? "https://api.mapbox.com/styles/v1/mapbox/light-v10/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiaGl1IiwiYSI6InJWNGZJSzgifQ.xK1ndT3W8XL9lwVZrT6jvQ" : "https://api.mapbox.com/styles/v1/mapbox/dark-v10/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiaGl1IiwiYSI6InJWNGZJSzgifQ.xK1ndT3W8XL9lwVZrT6jvQ";
var tileURL = L.Browser.retina ? "https://api.mapbox.com/styles/v1/mapbox/light-v10/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoidGdlcnRpbiIsImEiOiJYTW5sTVhRIn0.X4B5APkxkWVaiSg3KqMCaQ" : "https://api.mapbox.com/styles/v1/mapbox/dark-v10/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoidGdlcnRpbiIsImEiOiJYTW5sTVhRIn0.X4B5APkxkWVaiSg3KqMCaQ";
L.tileLayer(tileURL, {
attribution:'<a href="https://www.mapbox.com/about/maps">© Mapbox</a> <a href="http://openstreetmap.org/copyright">© OpenStreetMap</a>'
}).addTo(map);

//var featureLayer = L.mapbox.featureLayer().loadURL('{{ site.baseurl }}/events.geojson',{
var featureLayer = L.mapbox.featureLayer().loadURL('https://o5sxlalqle.execute-api.us-east-1.amazonaws.com/dev/events_geojson',{ style: L.mapbox.simplestyle.style })
//var featureLayer = L.geoJson(geojson, { style: L.mapbox.simplestyle.style }).addTo(map);

featureLayer.addTo(map);

featureLayer.on('ready', function() {
map.fitBounds(featureLayer.getBounds());
});
featureLayer.on('layeradd', function(e) {
var marker = e.layer,
feature = marker.feature;
// Create custom popup content
var popupContent = '<h2 class="text-center" style="color: #8cc250">'+feature.properties.event_name+'</h2>';
// http://leafletjs.com/reference.html#popup
marker.bindPopup(popupContent,{
minWidth: 200,
closeButton: false,
});
});
//var featureLayer = L.mapbox.featureLayer().loadURL('https://o5sxlalqle.execute-api.us-east-1.amazonaws.com/dev/events_geojson',{ style: L.mapbox.simplestyle.style })
// Fetch data from the API
fetch('{{ site.api }}')
.then(response => response.json())
.then(data => {
// Convert each data item's 'files' string to a JSON object
const geojsonFeatures = data.map(item => JSON.parse(item.files));

// Add the geojson data to the map
var featureLayer = L.mapbox.featureLayer()
.setGeoJSON(geojsonFeatures)
.addTo(map)
.setStyle(L.mapbox.simplestyle.style);

// Adjust map view
map.fitBounds(featureLayer.getBounds());

// Attach a popup to each marker
featureLayer.eachLayer(function(layer) {
const properties = layer.feature.properties;
const popupContent = '<h2 class="text-center" style="color: #8cc250">' + (properties.event_name || 'No Event Name') + '</h2>';
layer.bindPopup(popupContent, {
minWidth: 200,
closeButton: false,
});
});
})
.catch(error => {
console.error('There was an error fetching data from the API:', error);
});



</script>
16 changes: 8 additions & 8 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<!--
<a class='small {% if page.url contains "metrics" %}active{% endif %}' href='{{site.baseurl}}/metrics/'>Metrics</a>
-->
<a class='small' href='https://osmstories.site/' target="_blank">OSM Stories</a>
<a class='small' href='https://teachosm.org/' target="_blank">TeachOSM</a>
</div>
</div>

Expand Down Expand Up @@ -161,17 +161,17 @@ <h2 class='space-bottom1'>Participating Groups</h2>
<img src="{{site.baseurl}}/img/logos/MapPH_Logo_Clear.png" style="height:55px;margin-top:20px">
</a>

<a href='http://secondarycities.state.gov/' >
<!-- <a href='http://secondarycities.state.gov/' >
<img src="{{site.baseurl}}/img/logos/2C_LogoWhiteOnBlue_small.png" style="height:50px;margin-top:15px">
</a>
</a> -->

<a href='http://eca.state.gov/programs-initiatives/international-education-week' >
<img src="{{site.baseurl}}/img/logos/IEW_inverse.png" style="height:50px;margin-top: 10px;">
</a>

<a href='http://www.pepfar.gov/' >
<!-- <a href='http://www.pepfar.gov/' >
<img src="{{site.baseurl}}/img/logos/PEPFAR_Logo_transparent.gif" style="height:100px;margin-top:5px">
</a>
</a> -->

<a href='http://americangeo.org/' >
<img src="{{site.baseurl}}/img/logos/ags_green_logo.png" style="height:90px;margin-top:10px">
Expand All @@ -181,9 +181,9 @@ <h2 class='space-bottom1'>Participating Groups</h2>
<img src="{{site.baseurl}}/img/logos/youth_innovation_lab_logo_redesign.png" style="height:50px;margin-top:25px">
</a>

<a href='http://www.critigen.com' >
<!-- <a href='http://www.critigen.com' >
<img src="{{site.baseurl}}/img/logos/critigen_logo.jpg" style="height:50px;margin-top:25px">
</a>
</a> -->

<a href='https://wiki.openstreetmap.org/wiki/EuYoutH_OSM' >
<img src="{{site.baseurl}}/img/logos/EuYoutHLogo2.jpeg" style="height:75px;margin-top:25px">
Expand All @@ -201,7 +201,7 @@ <h2 class='space-bottom1'>Participating Groups</h2>

<section class='fill-white pad2y center'>
<div class='limiter' tx-content="translate_urls">
<p><strong>Interested in participating?</strong> Email <a href='mailto:[email protected]'>[email protected]</a> to learn more. <strong>Visit this site's <a href='https://github.com/state-hiu/osmgeoweek-2017'>Github repository</a></strong></p>
<p><strong>Interested in participating?</strong> Email <a href='mailto:[email protected] '>[email protected] </a> to learn more. <strong>Visit this site's <a href='https://github.com/state-hiu/osmgeoweek-2017'>Github repository</a></strong></p>
</div>
</section>
<footer class='col12 center fill-dark dark'>
Expand Down
2 changes: 1 addition & 1 deletion base/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ input[type=number] {
height:40px;
margin:0;
color:rgba(0,0,0,.5);
padding:10px;
/* padding:10px; */
border-radius:0;
-webkit-appearance:none;
}
Expand Down
10 changes: 5 additions & 5 deletions events/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class='limiter'>
<div class='pad2y'>
<h1 class='space-bottom1 space-top4'>Events</h1>
<p class='prose-big'> Find an event near you. Or, let us know if you are <a style="color:black" href="mailto:[email protected]">planning an event</a>, <a style="color:black" href="https://docs.google.com/forms/d/e/1FAIpQLSd0o_FrsoGlpqKlG9q1WumFV8sW8P9yhH4Udln_1fQbYjXn9A/viewform">submit the details</a> or <a style="color:black" href="mailto:[email protected]">get in touch</a>!</p>
<p class='prose-big'> Find an event near you. Or, let us know if you are <a style="color:black" href="mailto:[email protected] ">planning an event</a>, <a style="color:black" href="https://docs.google.com/forms/d/e/1FAIpQLSd0o_FrsoGlpqKlG9q1WumFV8sW8P9yhH4Udln_1fQbYjXn9A/viewform">submit the details</a> or <a style="color:black" href="mailto:[email protected] ">get in touch</a>!</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -41,7 +41,7 @@ <h1 class='space-bottom1 space-top4'>Events</h1>
// use fetch to retrieve it, and report any errors that occur in the fetch operation
// once the products have been successfully loaded and formatted as a JSON object
// using response.json(), run the initialize() function
fetch('https://o5sxlalqle.execute-api.us-east-1.amazonaws.com/dev/events').then(function(response) {
fetch('https://script.google.com/macros/s/AKfycbxqU4I_53-7iFrC88cO9pSYupPVxjs83Mi5uXIB8ilSTMXjkLrtXmu0QcApZh2NfQky/exec').then(function(response) {
if (response.ok) {
response.json().then(function(json) {
console.log('response is ok');
Expand All @@ -64,16 +64,16 @@ <h1 class='space-bottom1 space-top4'>Events</h1>

// set
//t.content.querySelector('img').src = 'demo.png';
t.content.querySelector('#title').textContent = events[i].event_name;
t.content.querySelector('#title').textContent = events[i].name;
t.content.querySelector('#location').textContent = events[i].location;
t.content.querySelector('#country').textContent = events[i].country;
//t.content.querySelector('#time').textContent = events[i].start_time;
t.content.querySelector('#date').textContent = events[i].date;
//t.content.querySelector('#organization').textContent = events[i].org_name;
t.content.querySelector('#sign_up_link').textContent = events[i].sign_up_link;
t.content.querySelector('#sign_up_link').textContent = events[i].link;

// https://www.digitalocean.com/community/tutorials/how-to-modify-attributes-classes-and-styles-in-the-dom
t.content.querySelector('#sign_up_link').setAttribute('href', events[i].sign_up_link);
t.content.querySelector('#sign_up_link').setAttribute('href', events[i].link);

console.log('print date');
console.log(events[i].date);
Expand Down
Loading

0 comments on commit f1ae903

Please sign in to comment.