-
Notifications
You must be signed in to change notification settings - Fork 9
Add dynamic "next meetup" to home page #33
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
239fc2a
eab0b7b
0fb041e
e71a23a
5189c44
948be99
0831c50
a59a1b0
46cb714
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
<h1>Welcome to techcorridor.io</h1> | ||
<p>TechCorridor.io is a developer group in Iowa City and Cedar Rapids, IA. If you’re interested in programming, the intertubes, and whatnot, this is the group for you.</p> | ||
<p><a class="btn btn-primary btn-lg" href="http://www.meetup.com/techcorridorio" role="button">Join us at one of our Meetups!</a></p> | ||
<p id="meetup-event"></p> | ||
</div> | ||
</div> | ||
|
||
|
@@ -28,3 +29,53 @@ <h2>Twitter</h2> | |
</div> | ||
</div> | ||
</div> | ||
|
||
{% raw %} | ||
<script type="text/javascript"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be nice to have this in a separate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved most of the js code to |
||
//assume Mustache is loaded | ||
//assume Meetup is loaded | ||
|
||
// Modify from _includes/meetup_cards.html | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we refactor that code so it's reusable without copying and pasting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved all the js code to |
||
|
||
window.onload = function(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot use |
||
var configuration = { | ||
"maxEvents": 5, | ||
"url": "https://api.meetup.com/2/events?callback=JSON_CALLBACK&offset=0&format=json&limited_events=False&group_urlname=techcorridorio&page=200&fields=&order=time&desc=false&status=upcoming&sig_id=168857872&sig=e659cc6038d27adf6eae600a44905c69196c77df" | ||
} | ||
var meetup = new Meetup(configuration.url).getEvents(function(data) { | ||
eventPresenter = EventPresenter(data.results[0]); | ||
createEventParagraph(eventPresenter); | ||
}); | ||
|
||
var createEventParagraph = function (event) { | ||
var template = "Next meetup: <a href='{{event_url}}' target='_blank'>{{name}} ({{formattedDate}})</a>"; | ||
Mustache.parse(template); // optional, speeds up future uses | ||
var rendered = Mustache.render(template, event); | ||
$('#meetup-event').html(rendered); | ||
}; | ||
|
||
var EventPresenter = function(event) { | ||
var formatVenueLink = function(venue) { | ||
var formattedVenue = "http://maps.google.com/?q=" + encodeURI(venue.address_1) + '+' + encodeURI(venue.city); | ||
return formattedVenue | ||
}; | ||
var formatDate = function(date) { | ||
// Pretty print the event date | ||
var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | ||
var months = [ | ||
"January", "February", "March", "April", | ||
"May", "June", "July", "August", | ||
"September", "October", "November", "December" | ||
]; | ||
|
||
return months[date.getMonth()] + ' ' | ||
+ date.getDate(); | ||
} | ||
|
||
event.venueLink = formatVenueLink(event.venue); | ||
event.formattedDate = formatDate(new Date(event.time)); | ||
return event; | ||
} | ||
} | ||
</script> | ||
{% endraw %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it.