Skip to content

Commit 9a8ffa1

Browse files
Created chapters collection where basic chapters info will be stored and I think also the layout to use in the actual chapters page.
Created london_python_sprints.md chapter. Created madrid_test_sprints.md chapter. Created szczecin_test_sprints.md chapter. Removed address from newest event - duplication with the sponsor's data. Added chapters to the config for collections in _config.yml and _config_dev.yml. Created logic generating chapters javascript variable (JSON) using Liquid tags. Tested above on the chapters map with the 3 chapters - working ok. See if map related (mapInit etc.) javascript can be moved into site.js. (variable generation with liquid tags has to stay in html file). Commented variable and certain fragments of map related js code to test my own variable. This commented code should be moved out but not deleted - can be used later on.
1 parent b49df22 commit 9a8ffa1

File tree

7 files changed

+83
-38
lines changed

7 files changed

+83
-38
lines changed

_chapters/london_python_sprints.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
chapter_id: london_python_sprints
3+
chapter_name: "London Python Sprints"
4+
chapter_meetup_link: https://www.meetup.com/Python-Sprints/
5+
chapter_location: London, United Kingdom
6+
lat: 51.512344
7+
lng: -0.090985
8+
---

_chapters/madrid_test_sprints.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
chapter_id: madrid_test_sprints
3+
chapter_name: "Madrid Test Sprints"
4+
chapter_meetup_link: https://www.meetup.com/Python-Sprints/
5+
chapter_location: Madrid, Spain
6+
lat: 40.416775
7+
lng: -3.703790
8+
---

_chapters/szczecin_test_sprints.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
chapter_id: szczecin_test_sprints
3+
chapter_name: "Szczecin Test Sprints"
4+
chapter_meetup_link: https://www.meetup.com/Python-Sprints/
5+
chapter_location: Szcecin, Poland
6+
lat: 53.428544
7+
lng: 14.552812
8+
---

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ exclude:
2323
future: true
2424
collections:
2525
- sponsors
26+
- chapters
2627

2728
# command to run build locally:
2829
# bundle exec jekyll serve --config _config.yml,_config_dev.yml

_config_dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ exclude:
2323
future: true
2424
collections:
2525
- sponsors
26+
- chapters
2627

2728
# command to run build locally:
2829
# bundle exec jekyll serve --host 0.0.0.0 --config _config.yml,_config_dev.yml

chapter_001_london/_posts/2018-03-20-Pandas-Beginners-Friendly.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ project_link: http://pandas.pydata.org/index.html
99
date: 2018-03-20
1010
time: "18:30"
1111
venue: Harvey Nash, London
12-
address: 110 Bishopsgate,<br>London,<br>EC2N 4AY
1312
meetup_link: https://www.meetup.com/Python-Sprints/events/248711552/
1413
event_link:
1514
image:

index.html

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
---
22
layout: default
33
---
4+
5+
{% assign chapters = "" | split: ',' %}
6+
{% for chapter in site.chapters %}
7+
{% assign chapters = chapters | push: chapter %}
8+
{% endfor %}
9+
{% comment %}
10+
Create a javascript variable for use in the function adding map markers.
11+
{% endcomment %}
12+
<script>
13+
var chapters = [
14+
{% for chapter in site.chapters %}
15+
{"chapterId": "{{ chapter.chapter_id }}",
16+
"chapterName": "{{ chapter.chapter_name }}",
17+
"chapterUrl": "{{ chapter.chapter_meetup_link }}",
18+
"chapterLocation": "{{ chapter.chapter_location }}",
19+
"lat": {{ chapter.lat }},
20+
"lng": {{ chapter.lng }}},
21+
{% endfor %}
22+
];
23+
</script>
24+
25+
{% comment %}}
426
<script type="text/javascript">
527
var chapters = [
628
// Europe
@@ -308,6 +330,7 @@
308330
"lat": -1.300474,
309331
"lng": 36.784610},
310332
];
333+
{% endcomment %}
311334
</script>
312335
<div class="navigation__content container-fluid">
313336
<picture>
@@ -436,48 +459,46 @@ <h2 class="chapters__title">Chapters</h2>
436459
<div class="col-12 my-auto">
437460
<div id="chapters__map"></div>
438461
<script>
439-
function initMap() {
440-
var infowindow=new google.maps.InfoWindow();
462+
function initMap() {
463+
var infowindow = new google.maps.InfoWindow();
441464

442-
var map = new google.maps.Map(document.getElementById('chapters__map'), {
443-
zoom: 2,
444-
center: {lat: 20., lng: 0.}
445-
});
465+
var map = new google.maps.Map(document.getElementById('chapters__map'), {
466+
zoom: 2,
467+
center: {lat: 20., lng: 0.}
468+
});
446469

447-
for (i=0; i < chapters.length; i++) {
448-
var desc = '<b>' + chapters[i]['description'] + '</b><br/><br/>';
449-
desc += 'Starts at: ' + chapters[i]['time'] + ' (local time)</br>';
450-
desc += 'Address:<br/>' + chapters[i]['address'] + '</br>';
451-
if (chapters[i]['sponsor_image'] != '') {
452-
desc += '<br/>With the support of:<br/>';
453-
desc += '<a href="' + chapters[i]['sponsor_url'] + '"><img style="width: 120px;" alt="" src="assets/images/sponsors/' + chapters[i]['sponsor_image'] + '"/></a><br/>';
470+
for (i = 0; i < chapters.length; i++) {
471+
var desc = '<b>' + chapters[i]['chapterName'] + '</b><br/><br/>';
472+
// desc += 'Starts at: ' + chapters[i]['time'] + ' (local time)</br>';
473+
desc += 'Location:<br/>' + chapters[i]['chapterLocation'] + '</br>';
474+
// if (chapters[i]['sponsor_image'] != '') {
475+
// desc += '<br/>With the support of:<br/>';
476+
// desc += '<a href="' + chapters[i]['sponsor_url'] + '"><img style="width: 120px;" alt="" src="assets/images/sponsors/' + chapters[i]['sponsor_image'] + '"/></a><br/>';
477+
// }
478+
desc += '<br/><a style="color: #800000;" href="' + chapters[i]['chapterUrl'] + '">Go to event page</a><br/>';
479+
var marker = new google.maps.Marker({
480+
title: chapters[i]["chapterName"],
481+
html: desc,
482+
position: {
483+
lat: chapters[i]["lat"],
484+
lng: chapters[i]["lng"]
485+
},
486+
map: map
487+
});
488+
google.maps.event.addListener(
489+
marker,
490+
'click',
491+
function () {
492+
infowindow.setContent(this.html);
493+
infowindow.open(map, this);
494+
}
495+
);
454496
}
455-
desc += '<br/><a style="color: #800000;" href="' + chapters[i]['url'] + '">Go to event page</a><br/>';
456-
var marker = new google.maps.Marker({
457-
title: chapters[i]["title"],
458-
html: desc,
459-
position: {lat: chapters[i]["lat"],
460-
lng: chapters[i]["lng"]},
461-
map: map
462-
});
463-
google.maps.event.addListener(
464-
marker,
465-
'click',
466-
function(){
467-
infowindow.setContent(this.html);
468-
infowindow.open(map,this);
469-
}
470-
);
471497
}
472-
473-
}
474498
</script>
475499
<script async defer
476500
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB0NCzoIqGkYFdpRl-LmgWTKpxPBkqxxO0&callback=initMap">
477501
</script>
478-
479-
480-
481502
</div>
482503
</div>
483504
</div>
@@ -487,11 +508,10 @@ <h2 class="chapters__title">Chapters</h2>
487508
</div>
488509
</div>
489510

490-
491-
492-
511+
{% comment %}
493512
<!--Events in the past section-->
494513
{% include recent_events_section.html %}
514+
{% endcomment %}
495515

496516
<!--Services section-->
497517
<section class="services">

0 commit comments

Comments
 (0)