You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by sa...@apache.org on 2016/05/27 02:46:21 UTC
incubator-apex-site git commit: Fixing venue display for online
meetups; Adding official groups filter
Repository: incubator-apex-site
Updated Branches:
refs/heads/master e9bcbed3a -> 1b13619fb
Fixing venue display for online meetups; Adding official groups filter
Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/commit/1b13619f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/tree/1b13619f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-site/diff/1b13619f
Branch: refs/heads/master
Commit: 1b13619fb6cb54b809f1339b4b723ee1614cd1c6
Parents: e9bcbed
Author: sashadt <sa...@datatorrent.com>
Authored: Thu May 26 19:46:14 2016 -0700
Committer: sashadt <sa...@datatorrent.com>
Committed: Thu May 26 19:46:14 2016 -0700
----------------------------------------------------------------------
README.md | 119 ++++++++++++++++++++++++++--------------
src/md/upcoming-meetups.md | 8 +--
2 files changed, 81 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-apex-site/blob/1b13619f/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a32b5c1..1dccc54 100644
--- a/README.md
+++ b/README.md
@@ -166,11 +166,17 @@ To update the widget, or change the topic, go to the [Meetup Widget Foundry]http
var $queries = {
events: function() {
return mup_widget.api_call("/2/open_events", {topic: $parameters.topic, page: '1000'});
- }
+ },
+
};
</script>
<link rel="stylesheet" type="text/css" href="https://a248.e.akamai.net/secure.meetupstatic.com/style/widget.css">
<script type="text/javascript" charset="utf-8">
+
+ // Create a list of official groups and launch their queries
+ var getApexGroupsDfd = $.getJSON("https://api.meetup.com/pro/apacheapex/groups?callback=?&format=json&page=1000&upcoming_events_min=1&sig_id=195396513&sig=abcb7c913f581e4f2efaaaeeac60a5ad0175cce9");
+ var getIngestGroupsDfd = $.getJSON("https://api.meetup.com/pro/BigDataHadoopIngestTransform/groups?callback=?&format=json&page=1000&upcoming_events_min=1&sig_id=203734787&sig=e59b141fca93ddf432efa4b7bb5f3173cce4add6");
+
mup_widget.with_jquery(function($, ctx) {
var group = '',
months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
@@ -185,54 +191,83 @@ To update the widget, or change the topic, go to the [Meetup Widget Foundry]http
return months[date.getMonth()] + ' ' + addLeadingZero( date.getDate() ) + ', ' + date.getFullYear().toString();
};
- $.getJSON($queries.events(), function(data) {
- if (data.status && data.status.match(/^200/) == null) {
- console.log("Error loading Meetups events: ", data.status + ": " + data.details);
+ $.getJSON($queries.events(), function(events) {
+ if (events.status && events.status.match(/^200/) == null) {
+ console.log("Error loading Meetups events: ", events.status + ": " + events.details);
} else {
- if (data.results.length > 0) {
-
- // Sort results by meeting time, and if times are equal, by event.venue.name based on following ordering.
- // Venues names are sorted based on array index. Venues not listed below are index -1, so are sorted higher.
- var venueNameSortOrder = ['Live Webcast', 'Webinar', 'Webcast'];
- data.results.sort(function(a, b) {
- if (a.time > b.time) {
- return 1;
- }
- if (a.time < b.time) {
- return -1;
- }
- if (a.time === b.time) {
- if (a.venue && a.venue.name && b.venue && b.venue.name) {
- return venueNameSortOrder.indexOf(a.venue.name) - venueNameSortOrder.indexOf(b.venue.name);
+ if (events.results.length > 0) {
+
+ // Load the list of official groups to filter out non-relevant events
+ $.when(getApexGroupsDfd, getIngestGroupsDfd).done(function(apexGroupsRsp, ingestGroupsRsp){
+
+ var apexGroups = (apexGroupsRsp && apexGroupsRsp[0].data) ? apexGroupsRsp[0].data : [];
+ var ingestGroups = (ingestGroupsRsp && ingestGroupsRsp[0].data) ? ingestGroupsRsp[0].data : [];
+ var officialGroups = apexGroups.concat(ingestGroups).map(function(g) {
+ return g.urlname;
+ });
+ console.log({"Official Meetup Groups": officialGroups});
+
+
+ // Skip unofficial events based on official groups filter
+ var officialEvents = events.results.filter(function(event){
+ if (event.group && officialGroups.indexOf(event.group.urlname) >= 0) {
+ return true;
+ } else {
+ console.log("UNOFFICIAL GROUP EVENT (skipped): ", event.event_url, " group urlname: ", event.group.urlname);
+ return false;
+ }
+ });
+
+ // Sort results by meeting time, and if times are equal, by event.venue.name based on following ordering.
+ // Venues names are sorted based on array index. Venues not listed below are index -1, so are sorted higher.
+ var onlineVenues = ['Live Webcast', 'Webinar', 'Webcast'];
+ var venueNameSortOrder = onlineVenues;
+ officialEvents.sort(function(a, b) {
+ if (a.time > b.time) {
+ return 1;
+ }
+ if (a.time < b.time) {
+ return -1;
+ }
+ if (a.time === b.time) {
+ if (a.venue && a.venue.name && b.venue && b.venue.name) {
+ return venueNameSortOrder.indexOf(a.venue.name) - venueNameSortOrder.indexOf(b.venue.name);
+ }
+ return 0;
}
return 0;
- }
- return 0;
- });
-
+ });
+
+
+ var uniqueEventsByKey = {};
+ for (var i = 0; i < officialEvents.length; i++) {
+ var event = officialEvents[i];
+ var venue = event.venue;
+ var city = (venue && venue.city) ? venue.city : 'TBD';
+ var state_country = (venue) ? venue.state || venue.country : '' ;
+ var location = (state_country) ? city + ", " + state_country.toUpperCase() : city;
+ // If venue is online, replace location by venue name
+ if (venue && venue.name && onlineVenues.indexOf(venue.name) >=0) {
+ location = venue.name;
+ }
+ event.location = location;
+ // Check for duplicate events by event time
+ var eventKey = event.time ? event.time : event.name;
+
+ if (uniqueEventsByKey[eventKey]) {
+ console.log("DUPLICATE EVENT (skipped): ", event.event_url, " matches previous event ", uniqueEventsByKey[eventKey].event_url, " with date:", getFormattedDate(event.time), " and name ", event.name);
+ } else {
+ console.log("VALID EVENT (added): ", event.event_url, event);
+ uniqueEventsByKey[eventKey] = event;
+ $('.next-events', ctx).append('<p>'+ addLink(getFormattedDate(event.time) + " - " + event.location, event.event_url) + " - " + event.name + "</p>");
+ }
- var uniqueEventsByKey = {};
- for (var i = 0; i < data.results.length; i++) {
- var event = data.results[i];
- console.log(event);
- var venue = event.venue;
- var city = (venue && venue.city) ? venue.city : 'TBD';
- var state_country = (venue) ? venue.state || venue.country : '' ;
- var location = (state_country) ? city + ", " + state_country.toUpperCase() : city;
- event.location = location;
- // Check for duplicate events by event time
- var eventKey = event.time ? event.time : event.name;
-
- if (uniqueEventsByKey[eventKey]) {
- console.log("DUPLICATE EVENT (skipped): ", event.event_url, " matches previous event ", uniqueEventsByKey[eventKey].event_url, " with date:", getFormattedDate(event.time), " and name ", event.name);
- } else {
- uniqueEventsByKey[eventKey] = event;
- $('.next-events', ctx).append('<p>'+ addLink(getFormattedDate(event.time) + " - " + event.location, event.event_url) + " - " + event.name + "</p>");
}
- }
- }
+ });
+
+ }
}
});
http://git-wip-us.apache.org/repos/asf/incubator-apex-site/blob/1b13619f/src/md/upcoming-meetups.md
----------------------------------------------------------------------
diff --git a/src/md/upcoming-meetups.md b/src/md/upcoming-meetups.md
index 8cf92a4..352c6e0 100644
--- a/src/md/upcoming-meetups.md
+++ b/src/md/upcoming-meetups.md
@@ -1,15 +1,15 @@
## Upcoming Meetups
-<div id="1458176353510"></div>
+<div id="1464317047809"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>jQuery.noConflict();</script>
<script>
jQuery(function() {
- var scripts = ["var%20%24parameters%20%3D%20%7B%22topic%22%3A%22apache-apex%22%2C%22width%22%3A%22250%22%2C%22height%22%3A%221000%22%7D%3B%0Avar%20%24queries%20%3D%20%7B%20events%3A%20function%28%29%20%7B%20return%20%22https%3A//api.meetup.com/2/open_events%3Fand_text%3DFalse%26offset%3D0%26format%3Djson%26limited_events%3DFalse%26sig%3D3b7decaeff772cd10cb65730b81a845f8533cc8b%26topic%3Dapache-apex%26callback%3D%3F%26page%3D1000%26radius%3D25.0%26sig_id%3D87819142%26desc%3DFalse%26status%3Dupcoming%26_%3D1458176351397%26user_agent%3Dmeetup.widget%3Amug_stats%22%3B%20%7D%20%7D%3B%0A","%0Amup_widget.with_jquery%28function%28%24%2Cctx%29%7Bvar%20group%3D%27%27%2Cmonths%3D%5B%27Jan%27%2C%27Feb%27%2C%27Mar%27%2C%27Apr%27%2C%27May%27%2C%27Jun%27%2C%27Jul%27%2C%27Aug%27%2C%27Sep%27%2C%27Oct%27%2C%27Nov%27%2C%27Dec%27%5D%2CaddLink%3Dfunction%28content%2Clink%29%7Breturn%27%3Ca%20target%3D%22_blank%22%20href%3D%22%27+link+%27%22%3E%27+content+%27%3C/a%3E%27%3B%7D%2CaddLeadingZero%3Dfunct
ion%28num%29%7Breturn%28num%3C10%29%3F%28%270%27+num%29%3Anum%3B%7D%2CgetFormattedDate%3Dfunction%28millis%29%7Bvar%20date%3Dnew%20Date%28millis%29%3Breturn%20months%5Bdate.getMonth%28%29%5D+%27%20%27+addLeadingZero%28date.getDate%28%29%29+%27%2C%20%27+date.getFullYear%28%29.toString%28%29%3B%7D%3B%24.getJSON%28%24queries.events%28%29%2Cfunction%28data%29%7Bif%28data.status%26%26data.status.match%28/%5E200/%29%3D%3Dnull%29%7Bconsole.log%28%22Error%20loading%20Meetups%20events%3A%20%22%2Cdata.status+%22%3A%20%22+data.details%29%3B%7Delse%7Bif%28data.results.length%3E0%29%7Bvar%20venueNameSortOrder%3D%5B%27Live%20Webcast%27%2C%27Webinar%27%2C%27Webcast%27%5D%3Bdata.results.sort%28function%28a%2Cb%29%7Bif%28a.time%3Eb.time%29%7Breturn%201%3B%7Dif%28a.time%3Cb.time%29%7Breturn-1%3B%7Dif%28a.time%3D%3D%3Db.time%29%7Bif%28a.venue%26%26a.venue.name%26%26b.venue%26%26b.venue.name%29%7Breturn%20venueNameSortOrder.indexOf%28a.venue.name%29-venueNameSortOrder.indexOf%28b.venue.name%29%3B%7Dret
urn%200%3B%7Dreturn%200%3B%7D%29%3Bvar%20uniqueEventsByKey%3D%7B%7D%3Bfor%28var%20i%3D0%3Bi%3Cdata.results.length%3Bi++%29%7Bvar%20event%3Ddata.results%5Bi%5D%3Bconsole.log%28event%29%3Bvar%20venue%3Devent.venue%3Bvar%20city%3D%28venue%26%26venue.city%29%3Fvenue.city%3A%27TBD%27%3Bvar%20state_country%3D%28venue%29%3Fvenue.state%7C%7Cvenue.country%3A%27%27%3Bvar%20location%3D%28state_country%29%3Fcity+%22%2C%20%22+state_country.toUpperCase%28%29%3Acity%3Bevent.location%3Dlocation%3Bvar%20eventKey%3Devent.time%3Fevent.time%3Aevent.name%3Bif%28uniqueEventsByKey%5BeventKey%5D%29%7Bconsole.log%28%22DUPLICATE%20EVENT%20%28skipped%29%3A%20%22%2Cevent.event_url%2C%22%20matches%20previous%20event%20%22%2CuniqueEventsByKey%5BeventKey%5D.event_url%2C%22%20with%20date%3A%22%2CgetFormattedDate%28event.time%29%2C%22%20and%20name%20%22%2Cevent.name%29%3B%7Delse%7BuniqueEventsByKey%5BeventKey%5D%3Devent%3B%24%28%27.next-events%27%2Cctx%29.append%28%27%3Cp%3E%27+addLink%28getFormattedDate%28event.ti
me%29+%22%20-%20%22+event.location%2Cevent.event_url%29+%22%20-%20%22+event.name+%22%3C/p%3E%22%29%3B%7D%7D%7D%7D%7D%29%3B%7D%29%3B"];
- jQuery("#1458176353510").append(unescape("%3Clink%20rel%3D%22stylesheet%22%20type%3D%22text/css%22%20href%3D%22https%3A//a248.e.akamai.net/secure.meetupstatic.com/style/widget.css%22/%3E%0A%0A%3C/head%3E%3Cdiv%20class%3D%22next-events%22%3E%3C/div%3E"));
+ var scripts = ["var%20%24parameters%20%3D%20%7B%22topic%22%3A%22apache-apex%22%2C%22width%22%3A%22250%22%2C%22height%22%3A%221000%22%7D%3B%0Avar%20%24queries%20%3D%20%7B%20events%3A%20function%28%29%20%7B%20return%20%22https%3A//api.meetup.com/2/open_events%3Fand_text%3DFalse%26offset%3D0%26format%3Djson%26limited_events%3DFalse%26sig%3D3b7decaeff772cd10cb65730b81a845f8533cc8b%26topic%3Dapache-apex%26callback%3D%3F%26page%3D1000%26radius%3D25.0%26sig_id%3D87819142%26desc%3DFalse%26status%3Dupcoming%26_%3D1464317046648%26user_agent%3Dmeetup.widget%3Amug_stats%22%3B%20%7D%20%7D%3B%0A","%0Avar%20getApexGroupsDfd%3D%24.getJSON%28%22https%3A//api.meetup.com/pro/apacheapex/groups%3Fcallback%3D%3F%26format%3Djson%26page%3D1000%26upcoming_events_min%3D1%26sig_id%3D195396513%26sig%3Dabcb7c913f581e4f2efaaaeeac60a5ad0175cce9%22%29%3Bvar%20getIngestGroupsDfd%3D%24.getJSON%28%22https%3A//api.meetup.com/pro/BigDataHadoopIngestTransform/groups%3Fcallback%3D%3F%26format%3Djson%26page%3D1000%26u
pcoming_events_min%3D1%26sig_id%3D203734787%26sig%3De59b141fca93ddf432efa4b7bb5f3173cce4add6%22%29%3Bmup_widget.with_jquery%28function%28%24%2Cctx%29%7Bvar%20group%3D%27%27%2Cmonths%3D%5B%27Jan%27%2C%27Feb%27%2C%27Mar%27%2C%27Apr%27%2C%27May%27%2C%27Jun%27%2C%27Jul%27%2C%27Aug%27%2C%27Sep%27%2C%27Oct%27%2C%27Nov%27%2C%27Dec%27%5D%2CaddLink%3Dfunction%28content%2Clink%29%7Breturn%27%3Ca%20target%3D%22_blank%22%20href%3D%22%27+link+%27%22%3E%27+content+%27%3C/a%3E%27%3B%7D%2CaddLeadingZero%3Dfunction%28num%29%7Breturn%28num%3C10%29%3F%28%270%27+num%29%3Anum%3B%7D%2CgetFormattedDate%3Dfunction%28millis%29%7Bvar%20date%3Dnew%20Date%28millis%29%3Breturn%20months%5Bdate.getMonth%28%29%5D+%27%20%27+addLeadingZero%28date.getDate%28%29%29+%27%2C%20%27+date.getFullYear%28%29.toString%28%29%3B%7D%3B%24.getJSON%28%24queries.events%28%29%2Cfunction%28events%29%7Bif%28events.status%26%26events.status.match%28/%5E200/%29%3D%3Dnull%29%7Bconsole.log%28%22Error%20loading%20Meetups%20events%3A%20%22%2
Cevents.status+%22%3A%20%22+events.details%29%3B%7Delse%7Bif%28events.results.length%3E0%29%7B%24.when%28getApexGroupsDfd%2CgetIngestGroupsDfd%29.done%28function%28apexGroupsRsp%2CingestGroupsRsp%29%7Bvar%20apexGroups%3D%28apexGroupsRsp%26%26apexGroupsRsp%5B0%5D.data%29%3FapexGroupsRsp%5B0%5D.data%3A%5B%5D%3Bvar%20ingestGroups%3D%28ingestGroupsRsp%26%26ingestGroupsRsp%5B0%5D.data%29%3FingestGroupsRsp%5B0%5D.data%3A%5B%5D%3Bvar%20officialGroups%3DapexGroups.concat%28ingestGroups%29.map%28function%28g%29%7Breturn%20g.urlname%3B%7D%29%3Bconsole.log%28%7B%22Official%20Meetup%20Groups%22%3AofficialGroups%7D%29%3Bvar%20officialEvents%3Devents.results.filter%28function%28event%29%7Bif%28event.group%26%26officialGroups.indexOf%28event.group.urlname%29%3E%3D0%29%7Breturn%20true%3B%7Delse%7Bconsole.log%28%22UNOFFICIAL%20GROUP%20EVENT%20%28skipped%29%3A%20%22%2Cevent.event_url%2C%22%20group%20urlname%3A%20%22%2Cevent.group.urlname%29%3Breturn%20false%3B%7D%7D%29%3Bvar%20onlineVenues%3D%5B%27Li
ve%20Webcast%27%2C%27Webinar%27%2C%27Webcast%27%5D%3Bvar%20venueNameSortOrder%3DonlineVenues%3BofficialEvents.sort%28function%28a%2Cb%29%7Bif%28a.time%3Eb.time%29%7Breturn%201%3B%7Dif%28a.time%3Cb.time%29%7Breturn-1%3B%7Dif%28a.time%3D%3D%3Db.time%29%7Bif%28a.venue%26%26a.venue.name%26%26b.venue%26%26b.venue.name%29%7Breturn%20venueNameSortOrder.indexOf%28a.venue.name%29-venueNameSortOrder.indexOf%28b.venue.name%29%3B%7Dreturn%200%3B%7Dreturn%200%3B%7D%29%3Bvar%20uniqueEventsByKey%3D%7B%7D%3Bfor%28var%20i%3D0%3Bi%3CofficialEvents.length%3Bi++%29%7Bvar%20event%3DofficialEvents%5Bi%5D%3Bvar%20venue%3Devent.venue%3Bvar%20city%3D%28venue%26%26venue.city%29%3Fvenue.city%3A%27TBD%27%3Bvar%20state_country%3D%28venue%29%3Fvenue.state%7C%7Cvenue.country%3A%27%27%3Bvar%20location%3D%28state_country%29%3Fcity+%22%2C%20%22+state_country.toUpperCase%28%29%3Acity%3Bif%28venue%26%26venue.name%26%26onlineVenues.indexOf%28venue.name%29%3E%3D0%29%7Blocation%3Dvenue.name%3B%7Devent.location%3Dlocation
%3Bvar%20eventKey%3Devent.time%3Fevent.time%3Aevent.name%3Bif%28uniqueEventsByKey%5BeventKey%5D%29%7Bconsole.log%28%22DUPLICATE%20EVENT%20%28skipped%29%3A%20%22%2Cevent.event_url%2C%22%20matches%20previous%20event%20%22%2CuniqueEventsByKey%5BeventKey%5D.event_url%2C%22%20with%20date%3A%22%2CgetFormattedDate%28event.time%29%2C%22%20and%20name%20%22%2Cevent.name%29%3B%7Delse%7Bconsole.log%28%22VALID%20EVENT%20%28added%29%3A%20%22%2Cevent.event_url%2Cevent%29%3BuniqueEventsByKey%5BeventKey%5D%3Devent%3B%24%28%27.next-events%27%2Cctx%29.append%28%27%3Cp%3E%27+addLink%28getFormattedDate%28event.time%29+%22%20-%20%22+event.location%2Cevent.event_url%29+%22%20-%20%22+event.name+%22%3C/p%3E%22%29%3B%7D%7D%7D%29%3B%7D%7D%7D%29%3B%7D%29%3B"];
+ jQuery("#1464317047809").append(unescape("%3Clink%20rel%3D%22stylesheet%22%20type%3D%22text/css%22%20href%3D%22https%3A//a248.e.akamai.net/secure.meetupstatic.com/style/widget.css%22/%3E%0A%0A%3C/head%3E%3Cdiv%20class%3D%22next-events%22%3E%3C/div%3E"));
var mup_widget = {
with_jquery: function(block) {
- block(jQuery, document.getElementById("1458176353510"));
+ block(jQuery, document.getElementById("1464317047809"));
}
};
for (i in scripts) { eval(unescape(scripts[i])) }