FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add dynamic "next meetup" to home page by iLtc · Pull Request #33 · techcorridorio/techcorridorio.github.io · GitHub

Add dynamic "next meetup" to home page - #33

Open
iLtc wants to merge 9 commits into
techcorridorio:masterfrom
iLtc:next-meetup
Open

Add dynamic "next meetup" to home page#33
iLtc wants to merge 9 commits into
techcorridorio:masterfrom
iLtc:next-meetup

Conversation

iLtc commented Feb 11, 2017

Copy link
Copy Markdown
Contributor

This pull request tries to resolve #27 .

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

Comment thread index.html

// Modify from _includes/meetup_cards.html

window.onload = function(){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread index.html
</div>

{% raw %}
<script type="text/javascript">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It might be nice to have this in a separate .js file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I moved most of the js code to js/meetup-events.js but left the trigger code here.

Comment thread index.html Outdated
</div>
</div>

{% raw %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is this necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I removed it.

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

// Modify from _includes/meetup_cards.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we refactor that code so it's reusable without copying and pasting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown
Member

This is exactly what I was hoping for, but we should probably clean up the code a little before merging.

Comment thread js/meetup-events.js Outdated
};

var createEventParagraph = function (event) {
var template = "Next meetup: <a href='{{event_url}}' target='_blank'>{{name}} ({{formattedShortDate}})</a>";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Line is too long.
Mixed double and single quotes.

Comment thread js/meetup-events.js Outdated
+ (date.getHours() % 12) + ':'
+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())
+ ' '
+ (date.getHours() < 12 ? 'AM' : 'PM');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread js/meetup-events.js Outdated
+ ' at '
+ (date.getHours() % 12) + ':'
+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())
+ ' '

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread js/meetup-events.js Outdated
+ date.getFullYear()
+ ' at '
+ (date.getHours() % 12) + ':'
+ (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread js/meetup-events.js Outdated
+ date.getDate() + ', '
+ date.getFullYear()
+ ' at '
+ (date.getHours() % 12) + ':'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread js/meetup-events.js Outdated
var months = [
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed double and single quotes.

Comment thread js/meetup-events.js Outdated
var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var months = [
"January", "February", "March", "April",
"May", "June", "July", "August",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed double and single quotes.

Comment thread js/meetup-events.js Outdated

var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var months = [
"January", "February", "March", "April",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mixed double and single quotes.

Comment thread js/meetup-events.js Outdated
return "http://maps.google.com/?q=" + encodeURI(venue.address_1) + '+' + encodeURI(venue.city);
};

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Line is too long.
Mixed double and single quotes.

Comment thread js/meetup-events.js Outdated

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread js/meetup-events.js
return event;
};

var createEventParagraph = function (event) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

'createEventParagraph' is defined but never used.

Comment thread js/meetup-events.js
};
};

var EventPresenter = function(event) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

'EventPresenter' is defined but never used.

Comment thread js/meetup-events.js
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

'Mustache' is not defined.

Comment thread js/meetup-events.js
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

'Mustache' is not defined.

Comment thread js/meetup-events.js
'+' + encodeURI(venue.city);
};

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Line is too long.

iLtc commented Mar 13, 2018

Copy link
Copy Markdown
Contributor Author

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~

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL