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..42d4cec 100644 --- a/client/app/main/main.controller.js +++ b/client/app/main/main.controller.js @@ -1,10 +1,19 @@ '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; + $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') .success(function(data) { $scope.tags = data.upcoming_top_tags; // jshint ignore:line @@ -12,13 +21,17 @@ angular.module('fireflyApp') ); $scope.openEvent = function (eventId) { - $location.path('/' + eventId); + $location.path('/event/' + eventId); }; $scope.openTag = function (path) { $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 ...

+
+
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/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 3dd7086..3838e37 100644 --- a/client/index.html +++ b/client/index.html @@ -86,6 +86,7 @@ + @@ -93,6 +94,8 @@ + + diff --git a/server/routes.js b/server/routes.js index 94397a4..f47df3c 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); + } + res.redirect(301, 'http://' + DOMAIN + '/' + tagsRes.body._id + '/events'); + } /** * @param err * @param eventsRes @@ -51,9 +59,14 @@ 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); + return; + } 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 +100,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); }