Skip to content

Commit b5033d6

Browse files
committed
Made calendar look like the rest of the site
1 parent 63a14c6 commit b5033d6

10 files changed

+151
-307
lines changed

build

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/bin/bash
22

3-
markdown index.md > content.html
3+
markdown index.md | sed \
4+
-e 's/^.*--ROW.*$/<div class="row">/' \
5+
-e 's/^.*--COL.*$/<div class="small-12 medium-6 columns">/' \
6+
-e 's/^.*--END.*$/<\/div>/' \
7+
-e 's/^.*--CALENDAR.*$/<div id="calendar-events"><\/div>/' \
8+
> content.html
49
sed -e '/{CONTENT}/ {
510
r content.html
611
d
7-
}' < layout.html > index.html
12+
}' < layout.html > index.html

content.html

+14-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,20 @@ <h2>Internets</h2>
1111
<li><a href="irc://chat.freenode.net/sheffgeeks">#sheffgeeks</a> on <a href="http://freenode.net">Freenode IRC</a> (active!)</li>
1212
</ul>
1313

14-
<h2>Calendar</h2>
14+
<div class="row">
15+
<div class="small-12 medium-6 columns">
1516

16-
<p><a href="http://sheffieldgeeks.org.uk">http://sheffieldgeeks.org.uk</a></p>
17+
<h2>Upcoming</h2>
1718

18-
<div id="calendar"></div>
19+
<p>See more at <a href="http://sheffieldgeeks.org.uk">http://sheffieldgeeks.org.uk</a></p>
20+
21+
<div id="calendar-events"></div>
22+
23+
<p>See all on <a href="https://opentechcalendar.co.uk/area/40-sheffield">Open Tech Calendar</a><br />
24+
Powered By <a href="http://ican.hasacalendar.co.uk/">Has A Calendar</a></p>
25+
26+
</div>
27+
<div class="small-12 medium-6 columns">
1928

2029
<h2>Meatspace Meetups</h2>
2130

@@ -42,7 +51,8 @@ <h2>Meatspace Meetups</h2>
4251
<li><a href="https://twitter.com/NerdNiteSheff">Nerd Night Sheffield</a></li>
4352
</ul>
4453

45-
<h2>Events</h2>
54+
</div>
55+
</div>
4656

4757
<h2>Self-hosting initiative</h2>
4858

File renamed without changes.

css/listevents.css

-163
This file was deleted.

index.html

+34-10
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<link rel="stylesheet" href="/foundation.min.css" />
7-
<link rel="stylesheet" href="css/listevents.css" />
6+
<link rel="stylesheet" href="/css/foundation.min.css" />
87
<title>Sheffield Geeks</title>
9-
8+
<style type="text/css">
9+
.event p {
10+
white-space: pre-line;
11+
}
12+
</style>
1013
</head>
1114
<body>
1215
<div class="row">
@@ -24,11 +27,20 @@ <h2>Internets</h2>
2427
<li><a href="irc://chat.freenode.net/sheffgeeks">#sheffgeeks</a> on <a href="http://freenode.net">Freenode IRC</a> (active!)</li>
2528
</ul>
2629

27-
<h2>Calendar</h2>
30+
<div class="row">
31+
<div class="small-12 medium-6 columns">
32+
33+
<h2>Upcoming</h2>
34+
35+
<p>See more at <a href="http://sheffieldgeeks.org.uk">http://sheffieldgeeks.org.uk</a></p>
2836

29-
<p><a href="http://sheffieldgeeks.org.uk">http://sheffieldgeeks.org.uk</a></p>
37+
<div id="calendar-events"></div>
3038

31-
<div id="calendar"></div>
39+
<p>See all on <a href="https://opentechcalendar.co.uk/area/40-sheffield">Open Tech Calendar</a><br />
40+
Powered By <a href="http://ican.hasacalendar.co.uk/">Has A Calendar</a></p>
41+
42+
</div>
43+
<div class="small-12 medium-6 columns">
3244

3345
<h2>Meatspace Meetups</h2>
3446

@@ -55,7 +67,8 @@ <h2>Meatspace Meetups</h2>
5567
<li><a href="https://twitter.com/NerdNiteSheff">Nerd Night Sheffield</a></li>
5668
</ul>
5769

58-
<h2>Events</h2>
70+
</div>
71+
</div>
5972

6073
<h2>Self-hosting initiative</h2>
6174

@@ -82,9 +95,20 @@ <h1>Other Geeks</h1>
8295
for this page and send a pull request.</p>
8396
</div>
8497
</div>
85-
<script src="js/listevents.js"></script>
86-
<script>
87-
OpenACalendarWidgetListEvents.place("calendar","opentechcalendar.co.uk",{areaID: 40});
98+
<script src="/js/lodash.custom.min.js"></script>
99+
<script type="text/lodash-template" id="calendar-template">
100+
<% if (events.length) { %>
101+
<% events.forEach(function(event) { %>
102+
<div class="event">
103+
<h3><a href="<%- event.url %>"><%- event.summary %></a></h3>
104+
<p><strong><%- event.start.displaylocal %></strong>
105+
<%- event.description %></p>
106+
</div>
107+
<% }) %>
108+
<% } else { %>
109+
<p>No events are scheduled in the calendar.</p>
110+
<% } %>
88111
</script>
112+
<script src="/js/calendar.js"></script>
89113
</body>
90114
</html>

index.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@
99
* [Mailinglist](https://groups.google.com/forum/#!forum/sheffieldgeeks)
1010
* [#sheffgeeks](irc://chat.freenode.net/sheffgeeks) on [Freenode IRC](http://freenode.net) (active!)
1111

12-
## Calendar
12+
--ROW
13+
--COL
1314

14-
[http://sheffieldgeeks.org.uk](http://sheffieldgeeks.org.uk)
15+
## Upcoming
1516

16-
<div id="calendar"></div>
17+
See more at [http://sheffieldgeeks.org.uk](http://sheffieldgeeks.org.uk)
18+
19+
--CALENDAR
20+
21+
See all on [Open Tech Calendar](https://opentechcalendar.co.uk/area/40-sheffield)<br />
22+
Powered By [Has A Calendar](http://ican.hasacalendar.co.uk/)
23+
24+
--ENDCOL
25+
--COL
1726

1827
## Meatspace Meetups
1928

@@ -38,7 +47,8 @@
3847
* [Sheffield Linux User Group](http://www.sheflug.org.uk)
3948
* [Nerd Night Sheffield](https://twitter.com/NerdNiteSheff)
4049

41-
## Events
50+
--ENDCOL
51+
--ENDROW
4252

4353
## Self-hosting initiative
4454

js/calendar.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(function(elem, host, params, template) {
2+
3+
var LIMIT = 5;
4+
var baseUrl = '//' + host;
5+
var area = 'area/' + params.areaID;
6+
7+
function fetch() {
8+
var url = baseUrl + '/api1/' + area + '/events.jsonp';
9+
var script = document.createElement("script");
10+
script.type = 'text/javascript';
11+
var callbackName = 'calendarCallback' +
12+
('' + Math.random()).substring(2);
13+
window[callbackName] = response;
14+
script.src = url + '?callback=' + callbackName;
15+
document.head.appendChild(script);
16+
}
17+
18+
function response(res) {
19+
render(filter(res.data));
20+
}
21+
22+
function filter(data) {
23+
var i = 0;
24+
return data.filter(function(event) {
25+
return !event.deleted && ++i < LIMIT;
26+
})
27+
}
28+
29+
function render(events) {
30+
elem.innerHTML = _.template(template, {
31+
events: events
32+
});
33+
}
34+
35+
render([]);
36+
fetch();
37+
38+
})(
39+
document.getElementById('calendar-events'),
40+
"opentechcalendar.co.uk",
41+
{ areaID: 40 },
42+
document.getElementById('calendar-template').innerHTML
43+
);

0 commit comments

Comments
 (0)