Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

iLtc
Copy link
Contributor

@iLtc iLtc commented Feb 11, 2017

This pull request tries to resolve #27 .

image

Note: The javascript code, include the api signature, modify from _includes/meetup_cards.html .

We can also:

  • Add event description to the alt attribute
  • Change date format
  • Change link style
  • Move the javascript code to a separate file

index.html Outdated

// Modify from _includes/meetup_cards.html

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>?

index.html Outdated
@@ -28,3 +29,53 @@
</div>
</div>
</div>

{% raw %}
<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.

index.html Outdated
@@ -28,3 +29,53 @@
</div>
</div>
</div>

{% raw %}
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary?

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 removed it.

index.html Outdated
//assume Mustache is loaded
//assume Meetup is loaded

// Modify from _includes/meetup_cards.html
Copy link
Member

Choose a reason for hiding this comment

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

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 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.

@benjaminoakes
Copy link
Member

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

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.

+ (date.getHours() % 12) + ':'
+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())
+ ' '
+ (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.

+ ' at '
+ (date.getHours() % 12) + ':'
+ (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.

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

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.

+ date.getDate() + ', '
+ date.getFullYear()
+ ' at '
+ (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.

var months = [
"January", "February", "March", "April",
"May", "June", "July", "August",
"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 day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var months = [
"January", "February", "March", "April",
"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.


var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
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.

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

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 EventPresenter = function(event) {
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.

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.

@@ -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 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);

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 createEventParagraph = function (event) {
var template = 'Next meetup: <a href=\'{{event_url}}\' target=\'_blank\'>' +
'{{name}} ({{formattedShortDate}})</a>';
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.

'+' + encodeURI(venue.city);
};

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.

@iLtc
Copy link
Contributor Author

iLtc commented Mar 13, 2018

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, Mustache is defined in another file. I am not sure how to fix it here.

Let me know what you think~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dynamic "next meetup" to home page
3 participants