Add dynamic "next meetup" to home page#33
Add dynamic "next meetup" to home page#33iLtc wants to merge 9 commits intotechcorridorio:masterfrom
Conversation
Merge pull request techcorridorio#32 from iLtc/master
So that I can get the code back~ This reverts commit cfc403a.
|
|
||
| // Modify from _includes/meetup_cards.html | ||
|
|
||
| window.onload = function(){ |
There was a problem hiding this comment.
This should probably use $(document).ready(function ...) (or just $(function ...))
There was a problem hiding this comment.
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>?
| </div> | ||
|
|
||
| {% raw %} | ||
| <script type="text/javascript"> |
There was a problem hiding this comment.
It might be nice to have this in a separate .js file.
There was a problem hiding this comment.
I moved most of the js code to js/meetup-events.js but left the trigger code here.
| </div> | ||
| </div> | ||
|
|
||
| {% raw %} |
| //assume Mustache is loaded | ||
| //assume Meetup is loaded | ||
|
|
||
| // Modify from _includes/meetup_cards.html |
There was a problem hiding this comment.
Can we refactor that code so it's reusable without copying and pasting?
There was a problem hiding this comment.
I moved all the js code to js/meetup-events.js. If you want, I can refactor _includes/meetup_cards.html and _includes/developers_cards.html so they share the same code file.
|
This is exactly what I was hoping for, but we should probably clean up the code a little before merging. |
| }; | ||
|
|
||
| var createEventParagraph = function (event) { | ||
| var template = "Next meetup: <a href='{{event_url}}' target='_blank'>{{name}} ({{formattedShortDate}})</a>"; |
There was a problem hiding this comment.
Line is too long.
Mixed double and single quotes.
| + (date.getHours() % 12) + ':' | ||
| + (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) | ||
| + ' ' | ||
| + (date.getHours() < 12 ? 'AM' : 'PM'); |
There was a problem hiding this comment.
Misleading line break before '+'; readers may interpret this as an expression boundary.
| + ' at ' | ||
| + (date.getHours() % 12) + ':' | ||
| + (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) | ||
| + ' ' |
There was a problem hiding this comment.
Misleading line break before '+'; readers may interpret this as an expression boundary.
| + date.getFullYear() | ||
| + ' at ' | ||
| + (date.getHours() % 12) + ':' | ||
| + (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) |
There was a problem hiding this comment.
Line is too long.
Misleading line break before '+'; readers may interpret this as an expression boundary.
| + date.getDate() + ', ' | ||
| + date.getFullYear() | ||
| + ' at ' | ||
| + (date.getHours() % 12) + ':' |
There was a problem hiding this comment.
Misleading line break before '+'; readers may interpret this as an expression boundary.
| var months = [ | ||
| "January", "February", "March", "April", | ||
| "May", "June", "July", "August", | ||
| "September", "October", "November", "December" |
| var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | ||
| var months = [ | ||
| "January", "February", "March", "April", | ||
| "May", "June", "July", "August", |
|
|
||
| var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; | ||
| var months = [ | ||
| "January", "February", "March", "April", |
| 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.
Line is too long.
Mixed double and single quotes.
|
|
||
| var EventPresenter = function(event) { | ||
| var formatVenueLink = function(venue) { | ||
| return "http://maps.google.com/?q=" + encodeURI(venue.address_1) + '+' + encodeURI(venue.city); |
There was a problem hiding this comment.
Line is too long.
Mixed double and single quotes.
Identifier 'address_1' is not in camel case.
| return event; | ||
| }; | ||
|
|
||
| var createEventParagraph = function (event) { |
There was a problem hiding this comment.
'createEventParagraph' is defined but never used.
| }; | ||
| }; | ||
|
|
||
| var EventPresenter = function(event) { |
There was a problem hiding this comment.
'EventPresenter' 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 | ||
| var rendered = Mustache.render(template, event); |
| var createEventParagraph = function (event) { | ||
| var template = 'Next meetup: <a href=\'{{event_url}}\' target=\'_blank\'>' + | ||
| '{{name}} ({{formattedShortDate}})</a>'; | ||
| Mustache.parse(template); // optional, speeds up future uses |
| '+' + encodeURI(venue.city); | ||
| }; | ||
|
|
||
| var day = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; |
|
Sorry for the delay. I hope it was not too late. It is a little bit difficult to solve all the problems raised by HoundCI. For example, Let me know what you think~ |
This pull request tries to resolve #27 .
Note: The javascript code, include the api signature, modify from _includes/meetup_cards.html .
We can also:
altattribute