From d4bd40348689988453637550e0b4230495331811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 10:36:56 +0100 Subject: [PATCH 1/7] add view for event lists --- client/app/events/eventList.html | 59 ++++++++++++++++++++++++++++++ client/app/events/events.js | 11 ++++++ client/app/main/main.controller.js | 10 ++++- client/index.html | 1 + 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 client/app/events/eventList.html create mode 100644 client/app/events/events.js diff --git a/client/app/events/eventList.html b/client/app/events/eventList.html new file mode 100644 index 0000000..3cc5762 --- /dev/null +++ b/client/app/events/eventList.html @@ -0,0 +1,59 @@ +
+ + + + {{tag.title}} + + + +
+ + + +

About {{tag.title}}

+

{{tag.description}}

+
+
+ + + +

+ {{tag.title}} Events near you +

+ + +
+

{{ event.title }}

+

{{event.start | date : 'medium' : event.timezone}}

+
+
+
+ + Waiting for location... + +
+
+ + + +

+ Upcoming {{tag.title}} Events +

+ + +
+

{{ event.title }}

+

{{event.start | date : 'medium' : event.timezone}}

+
+
+
+ + No upcoming events in this series. + +
+
+ +
+
diff --git a/client/app/events/events.js b/client/app/events/events.js new file mode 100644 index 0000000..19cd6a2 --- /dev/null +++ b/client/app/events/events.js @@ -0,0 +1,11 @@ +'use strict'; + +angular.module('fireflyApp') + .config(function ($routeProvider) { + $routeProvider + .when('/:tag/events', { + templateUrl: 'app/events/eventList.html', + controller: 'MainCtrl', + controllerAs: 'vm' + }); + }); diff --git a/client/app/main/main.controller.js b/client/app/main/main.controller.js index c64e820..54ea590 100644 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -1,10 +1,16 @@ 'use strict'; angular.module('fireflyApp') - .controller('MainCtrl', function ($rootScope, $scope, $http, $location, $window, config) { + .controller('MainCtrl', function ($rootScope, $routeParams, $scope, $http, $location, $window, config) { $scope.domain = config.DOMAIN; $scope.nearEvent = undefined; + if ($routeParams.tag) { + $scope.prefix = $routeParams.tag; + $rootScope.tag = $routeParams.tag; + $scope.all = true; + } + $http.jsonp(config.HUB_IP + 'api/v1/events/stats?callback=JSON_CALLBACK') .success(function(data) { $scope.tags = data.upcoming_top_tags; // jshint ignore:line @@ -12,7 +18,7 @@ angular.module('fireflyApp') ); $scope.openEvent = function (eventId) { - $location.path('/' + eventId); + $location.path('/event/' + eventId); }; $scope.openTag = function (path) { diff --git a/client/index.html b/client/index.html index 3dd7086..b1b957f 100644 --- a/client/index.html +++ b/client/index.html @@ -86,6 +86,7 @@ + From efa4ca81487ac34f6c992a0bcd3c40a3f8ed20bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 10:38:16 +0100 Subject: [PATCH 2/7] use /event as path prefix, allow /:tag as url --- client/app/shorturl/shorturl.js | 5 +++++ server/routes.js | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/client/app/shorturl/shorturl.js b/client/app/shorturl/shorturl.js index 6246a89..887ca07 100644 --- a/client/app/shorturl/shorturl.js +++ b/client/app/shorturl/shorturl.js @@ -8,6 +8,11 @@ angular.module('fireflyApp') controller: 'ShorturlAnalyticsCtrl', controllerAs: 'vm' }) + .when('/event/:hash', { + templateUrl: 'app/shorturl/shorturlEvent.html', + controller: 'ShorturlEventCtrl', + controllerAs: 'vm' + }) .when('/:hash/', { templateUrl: 'app/shorturl/shorturlEvent.html', controller: 'ShorturlEventCtrl', diff --git a/server/routes.js b/server/routes.js index 94397a4..0bfe960 100644 --- a/server/routes.js +++ b/server/routes.js @@ -44,6 +44,14 @@ module.exports = function(app) { function(err, shortUrl) { var me = this; + function handleTagsResponse(err, tagsRes) { + if (err || !tagsRes || !tagsRes.body || !tagsRes.body._id) { + console.error(err); + // If there is an error looking up the shortUrl, just redirect to default prefix. + return res.redirect(301, 'http://' + DOMAIN); + } + redirect(me, req, res, 'http://' + DOMAIN + '/' + tagsRes.body._id + '/events'); + } /** * @param err * @param eventsRes @@ -51,9 +59,13 @@ module.exports = function(app) { */ function handleEventsResponse(err, eventsRes) { if (err || !eventsRes || !eventsRes.body || !eventsRes.body._id) { - console.error(err); - // If there is an error looking up the shortUrl, just redirect to default prefix. - return res.redirect(301, 'http://' + DOMAIN); + if (err && err.status == 404) { + request.get(HUB_IP + 'api/v1/tags/' + req.params.hash, handleTagsResponse); + } else { + console.error(err); + // If there is an error looking up the shortUrl, just redirect to default prefix. + return res.redirect(301, 'http://' + DOMAIN); + } } // Create a new DB entry for this new event shortUrl @@ -87,7 +99,7 @@ module.exports = function(app) { */ function redirect(me, req, res, shortUrl) { if (shortUrl.event_id) { - res.redirect(301, 'http://' + DOMAIN + '/' + shortUrl.event_id + '/'); + res.redirect(301, 'http://' + DOMAIN + '/event/' + shortUrl.event_id + '/'); } else { res.redirect(301, shortUrl.url); } From 7ed3fb77a60ebefc977505a914ccd5b60026be1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 11:02:49 +0100 Subject: [PATCH 3/7] fix redirecting tags --- server/routes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/routes.js b/server/routes.js index 0bfe960..f47df3c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -50,7 +50,7 @@ module.exports = function(app) { // If there is an error looking up the shortUrl, just redirect to default prefix. return res.redirect(301, 'http://' + DOMAIN); } - redirect(me, req, res, 'http://' + DOMAIN + '/' + tagsRes.body._id + '/events'); + res.redirect(301, 'http://' + DOMAIN + '/' + tagsRes.body._id + '/events'); } /** * @param err @@ -61,6 +61,7 @@ module.exports = function(app) { if (err || !eventsRes || !eventsRes.body || !eventsRes.body._id) { if (err && err.status == 404) { request.get(HUB_IP + 'api/v1/tags/' + req.params.hash, handleTagsResponse); + return; } else { console.error(err); // If there is an error looking up the shortUrl, just redirect to default prefix. From c5e0f1f50d7ecdca411b3de1163d2c4b745fb14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 11:09:49 +0100 Subject: [PATCH 4/7] only show the 100 upcoming events --- client/app/main/main.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/main/main.controller.js b/client/app/main/main.controller.js index 54ea590..bdea8d8 100644 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -8,7 +8,7 @@ angular.module('fireflyApp') if ($routeParams.tag) { $scope.prefix = $routeParams.tag; $rootScope.tag = $routeParams.tag; - $scope.all = true; + $scope.all = false; } $http.jsonp(config.HUB_IP + 'api/v1/events/stats?callback=JSON_CALLBACK') From eab9d03e1dd327b6f957c21e4266fa94c7346ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 11:26:06 +0100 Subject: [PATCH 5/7] update tag data --- client/app/main/main.controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/main/main.controller.js b/client/app/main/main.controller.js index bdea8d8..3d01c88 100644 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -7,8 +7,11 @@ angular.module('fireflyApp') if ($routeParams.tag) { $scope.prefix = $routeParams.tag; - $rootScope.tag = $routeParams.tag; $scope.all = false; + $http.jsonp(config.HUB_IP + 'api/v1/tags/' + $routeParams.tag + '?callback=JSON_CALLBACK') + .success(function (data) { + $scope.tag = data; + }); } $http.jsonp(config.HUB_IP + 'api/v1/events/stats?callback=JSON_CALLBACK') From e50d58d30427315a25efaffa42cf9560e9488b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 16:15:35 +0100 Subject: [PATCH 6/7] add simple UI for list of tags --- client/app/tags/tagList.controller.js | 14 ++++++++++++++ client/app/tags/tagList.html | 17 +++++++++++++++++ client/app/tags/tags.js | 11 +++++++++++ client/index.html | 2 ++ 4 files changed, 44 insertions(+) create mode 100644 client/app/tags/tagList.controller.js create mode 100644 client/app/tags/tagList.html create mode 100644 client/app/tags/tags.js diff --git a/client/app/tags/tagList.controller.js b/client/app/tags/tagList.controller.js new file mode 100644 index 0000000..ee5c454 --- /dev/null +++ b/client/app/tags/tagList.controller.js @@ -0,0 +1,14 @@ +angular.module('fireflyApp') + .controller('TagsCtrl', function ($rootScope, $scope, $http, $location, $window, config) { + $scope.domain = config.DOMAIN; + + $http.jsonp(config.HUB_IP + 'api/v1/tags/active?callback=JSON_CALLBACK').then(function(data){ + $scope.allTags=data; + }, function(err){ + $scope.error = err; + }); + + $scope.openTag = function (path) { + $window.location.href = 'http://' + config.DOMAIN + '/' + tag + '/events'; + }; + }); diff --git a/client/app/tags/tagList.html b/client/app/tags/tagList.html new file mode 100644 index 0000000..2b1aa03 --- /dev/null +++ b/client/app/tags/tagList.html @@ -0,0 +1,17 @@ +
+ + + + GDG Topics + +
+ + + +

{{tag}}

+

About {{tag.title}}

+

{{tag.description}}

+
+
+
+
diff --git a/client/app/tags/tags.js b/client/app/tags/tags.js new file mode 100644 index 0000000..5661951 --- /dev/null +++ b/client/app/tags/tags.js @@ -0,0 +1,11 @@ +'use strict'; + +angular.module('fireflyApp') + .config(function ($routeProvider) { + $routeProvider + .when('/tags/active', { + templateUrl: 'app/tags/tagList.html', + controller: 'TagsCtrl', + controllerAs: 'vm' + }); + }); diff --git a/client/index.html b/client/index.html index b1b957f..3838e37 100644 --- a/client/index.html +++ b/client/index.html @@ -94,6 +94,8 @@ + + From 77ebdc093855c8a57a2fd8e0b842d7ff8b762a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20Mu=CC=88ffke?= Date: Wed, 2 Dec 2015 20:49:55 +0100 Subject: [PATCH 7/7] Add link from main to tag list --- client/app/main/main.controller.js | 4 ++++ client/app/main/main.html | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/client/app/main/main.controller.js b/client/app/main/main.controller.js index 3d01c88..42d4cec 100644 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -28,6 +28,10 @@ angular.module('fireflyApp') $window.location.href = 'http://' + path; }; + $scope.openTagList = function () { + $window.location.href = 'http://' + config.DOMAIN + '/tags/active'; + }; + $scope.distanceFromHere = function (_item, _startPoint) { var start = null; diff --git a/client/app/main/main.html b/client/app/main/main.html index 1030a88..4b3529f 100644 --- a/client/app/main/main.html +++ b/client/app/main/main.html @@ -66,6 +66,13 @@

{{ key }}

{{ value }} events

+ +
+

All topics

+

more ...

+
+