-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add dynamic "next meetup" to home page #33
base: master
Are you sure you want to change the base?
Changes from all 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 |
---|---|---|
|
@@ -36,3 +36,50 @@ var Meetup = function(meetupURL) { | |
}); | ||
}; | ||
}; | ||
|
||
var EventPresenter = function(event) { | ||
var formatVenueLink = function(venue) { | ||
return 'http://maps.google.com/?q=' + encodeURI(venue.address_1) + | ||
'+' + encodeURI(venue.city); | ||
}; | ||
|
||
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', | ||
'May', 'June', 'July', 'August', | ||
'September', 'October', 'November', 'December' | ||
]; | ||
|
||
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()] + ' ' + | ||
date.getDate() + ', ' + | ||
date.getFullYear() + ' at ' + | ||
(date.getHours() % 12) + ':' + | ||
(date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ' ' + | ||
(date.getHours() < 12 ? 'AM' : 'PM'); | ||
}; | ||
|
||
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>'; | ||
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.
'EventPresenter' is defined but never used.