-
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 7 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,17 @@ <h2>Twitter</h2> | |
</div> | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
//assume Mustache is loaded | ||
//assume Meetup is loaded | ||
|
||
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 meetupUrl = "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"; | ||
|
||
new Meetup(meetupUrl).getEvents(function(data) { | ||
var eventPresenter = EventPresenter(data.results[0]); | ||
createEventParagraph(eventPresenter); | ||
}); | ||
}; | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,50 @@ var Meetup = function(meetupURL) { | |
}); | ||
}; | ||
}; | ||
|
||
var EventPresenter = function(event) { | ||
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. 'EventPresenter' is defined but never used. |
||
var formatVenueLink = function(venue) { | ||
return "http://maps.google.com/?q=" + encodeURI(venue.address_1) + '+' + encodeURI(venue.city); | ||
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. Line is too long. |
||
}; | ||
|
||
var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | ||
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. Line is too long. |
||
var months = [ | ||
"January", "February", "March", "April", | ||
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. Mixed double and single quotes. |
||
"May", "June", "July", "August", | ||
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. Mixed double and single quotes. |
||
"September", "October", "November", "December" | ||
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. Mixed double and single quotes. |
||
]; | ||
|
||
var formatShortDate = function(date) { | ||
// Pretty print the event date | ||
return months[date.getMonth()] + ' ' + date.getDate(); | ||
}; | ||
|
||
var formatLongDate = function(date) { | ||
// Pretty print the event date | ||
|
||
return day[date.getDay()] + ', ' | ||
+ months[date.getMonth()] + ' ' | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ date.getDate() + ', ' | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ date.getFullYear() | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ ' at ' | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ (date.getHours() % 12) + ':' | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) | ||
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. Line is too long. |
||
+ ' ' | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
+ (date.getHours() < 12 ? 'AM' : 'PM'); | ||
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. Misleading line break before '+'; readers may interpret this as an expression boundary. |
||
}; | ||
|
||
var eventDate = new Date(event.time); | ||
|
||
event.venueLink = formatVenueLink(event.venue); | ||
event.formattedShortDate = formatShortDate(eventDate); | ||
event.formattedLongDate = formatLongDate(eventDate); | ||
|
||
return event; | ||
}; | ||
|
||
var createEventParagraph = function (event) { | ||
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. 'createEventParagraph' is defined but never used. |
||
var template = "Next meetup: <a href='{{event_url}}' target='_blank'>{{name}} ({{formattedShortDate}})</a>"; | ||
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. Line is too long. |
||
Mustache.parse(template); // optional, speeds up future uses | ||
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. 'Mustache' is not defined. |
||
var rendered = Mustache.render(template, event); | ||
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. 'Mustache' is not defined. |
||
$('#meetup-event').html(rendered); | ||
}; |
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.
It might be nice to have this in a separate
.js
file.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 moved most of the js code to
js/meetup-events.js
but left the trigger code here.