Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,8 @@ body{
border: 1px solid #555;
}
/* Jumbotron end */

/* meetup-event for the home page */
#meetup-event a {
color: white;
}
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -28,3 +29,17 @@ <h2>Twitter</h2>
</div>
</div>
</div>

<script type="text/javascript">
Copy link
Member

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.

Copy link
Contributor Author

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.

//assume Mustache is loaded
//assume Meetup is loaded

window.onload = function(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably use $(document).ready(function ...) (or just $(function ...))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot use $(document).ready(function ...) here since jQuery will be imported after this code. Would you mind if I move <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> to <head>?

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>
47 changes: 47 additions & 0 deletions js/meetup-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,50 @@ var Meetup = function(meetupURL) {
});
};
};

var EventPresenter = function(event) {

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.

var formatVenueLink = function(venue) {
return "http://maps.google.com/?q=" + encodeURI(venue.address_1) + '+' + encodeURI(venue.city);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
Mixed double and single quotes.
Identifier 'address_1' is not in camel case.

};

var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
Mixed double and single quotes.

var months = [
"January", "February", "March", "April",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.

"May", "June", "July", "August",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed double and single quotes.

"September", "October", "November", "December"

Choose a reason for hiding this comment

The 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()] + ' '

Choose a reason for hiding this comment

The 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() + ', '

Choose a reason for hiding this comment

The 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()

Choose a reason for hiding this comment

The 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 '

Choose a reason for hiding this comment

The 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) + ':'

Choose a reason for hiding this comment

The 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())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
Misleading line break before '+'; readers may interpret this as an expression boundary.

+ ' '

Choose a reason for hiding this comment

The 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');

Choose a reason for hiding this comment

The 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) {

Choose a reason for hiding this comment

The 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>";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
Mixed double and single quotes.

Mustache.parse(template); // optional, speeds up future uses

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Mustache' is not defined.

var rendered = Mustache.render(template, event);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Mustache' is not defined.

$('#meetup-event').html(rendered);
};