From e95eeca2def21867ac1e6fe02a6d373a9d1cecda Mon Sep 17 00:00:00 2001 From: Vishal Reddy Date: Tue, 7 Oct 2014 16:11:49 -0400 Subject: [PATCH 01/41] Add ability to remove items from bucket list --- .bowerrc | 3 ++ Gruntfile.js | 4 +-- client/app/modules/pages/map/feed.html | 4 +-- client/app/modules/pages/map/feed.js | 14 ++++++++- .../services/footprintRequestsFactory.js | 10 ++++++ server/api/checkins/checkinController.js | 17 ++++++++++ server/api/checkins/checkinModel.js | 31 +++++++++++++++++++ server/api/checkins/checkinRoutes.js | 1 + 8 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 .bowerrc diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..beb7358 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory" : "client/bower_components" +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index f0cc37b..ada6f7e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,7 +12,7 @@ module.exports = function (grunt) { bower: { dest: 'client/dist/bower.js', src: ['client/bower_components/jquery/jquery.js', - 'client/bower_components/lodash/lodash.compat.js', + 'client/bower_components/lodash/dist/lodash.compat.js', 'client/bower_components/eventEmitter/EventEmitter.js', 'client/bower_components/get-style-property/get-style-property.js', 'client/bower_components/get-size/get-size.js', @@ -24,7 +24,7 @@ module.exports = function (grunt) { 'client/bower_components/masonry/masonry.js', 'client/bower_components/imagesloaded/imagesloaded.js', 'client/bower_components/angular/angular.js', - 'client/bower_components/angular-ui-router/angular-ui-router.js', + 'client/bower_components/angular-ui-router/release/angular-ui-router.min.js', 'client/bower_components/angular-masonry/angular-masonry.js', 'client/bower_components/angular-strap/dist/angular-strap.min.js', 'client/bower_components/angular-strap/dist/angular-strap.tpl.min.js', diff --git a/client/app/modules/pages/map/feed.html b/client/app/modules/pages/map/feed.html index 49c477f..3ebd660 100644 --- a/client/app/modules/pages/map/feed.html +++ b/client/app/modules/pages/map/feed.html @@ -4,8 +4,8 @@

{{footprint.place.name}}

- - + +
{{footprint.checkin.checkinTime | date : shortDate}}
diff --git a/client/app/modules/pages/map/feed.js b/client/app/modules/pages/map/feed.js index 4c09a43..8d2b23b 100644 --- a/client/app/modules/pages/map/feed.js +++ b/client/app/modules/pages/map/feed.js @@ -39,7 +39,7 @@ var FeedController = function (MapFactory, FootprintRequests, Auth, $scope, $roo }); }; - $scope.addCheckinToBucketlist = function (footprint){ + $scope.addCheckinToBucketList = function (footprint){ var bucketListData = { facebookID: window.sessionStorage.userFbID, checkinID: footprint.checkin.checkinID @@ -53,6 +53,18 @@ var FeedController = function (MapFactory, FootprintRequests, Auth, $scope, $roo }); }; + $scope.removeCheckinFromBucketList = function (footprint){ + console.log('removed?'); + var bucketListData = { + facebookID: window.sessionStorage.userFbID, + checkinID: footprint.checkin.checkinID + }; + FootprintRequests.removeFromBucketList(bucketListData) + .then(function (data){ + MapFactory.markerQuadTree.addPropertyToCheckin(footprint, 'bucketed', false); + }); + }; + $scope.selectedFootprintInteractions = null; // Send request to database for user props and comments data diff --git a/client/app/modules/services/footprintRequestsFactory.js b/client/app/modules/services/footprintRequestsFactory.js index 55b140c..523874a 100644 --- a/client/app/modules/services/footprintRequestsFactory.js +++ b/client/app/modules/services/footprintRequestsFactory.js @@ -20,6 +20,16 @@ var FootprintRequests = function ($http){ } }, + removeFromBucketList: function (data) { + if (data) { + return $http({ + method: 'POST', + data: data, + url: 'api/checkins/removebucket' + }); + } + }, + addComment: function (data) { if (data && data.text) { return $http({ diff --git a/server/api/checkins/checkinController.js b/server/api/checkins/checkinController.js index 253d93f..3c89620 100644 --- a/server/api/checkins/checkinController.js +++ b/server/api/checkins/checkinController.js @@ -128,6 +128,22 @@ checkinController.addToBucketList = function (req, res){ }); }; +checkinController.removeFromBucketList = function (req, res){ + console.log('in the controller!'); + var checkinID = req.body.checkinID; + var facebookID = req.body.facebookID; + + Checkin.removeFromBucketList(facebookID, checkinID) + .then(function (data){ + res.json(data); + res.status(201).end(); + }) + .catch(function(err) { + console.log(err); + res.status(500).end(); + }); +} + checkinController.addComment = function (req, res){ var clickerID = req.body.clickerID; var checkinID = req.body.checkinID; @@ -165,6 +181,7 @@ checkinController.giveProps = function (req, res){ }); }; + checkinController.getPropsAndComments = function (req, res){ var checkinID = req.params.checkinid; var data = {} diff --git a/server/api/checkins/checkinModel.js b/server/api/checkins/checkinModel.js index d06a94e..84a7b10 100644 --- a/server/api/checkins/checkinModel.js +++ b/server/api/checkins/checkinModel.js @@ -40,15 +40,46 @@ Checkin.addToBucketList = function(facebookID, checkinID){ 'RETURN checkin' ].join('\n'); + + var params = { + facebookID: facebookID, + checkinID: checkinID + }; + + console.log(params); + db.query(query, params, function (err, results) { + if (err) { deferred.reject(err); } + else { + deferred.resolve(results); + } + }); + + return deferred.promise; +}; + +Checkin.removeFromBucketList = function(facebookID, checkinID){ + var deferred = Q.defer(); + + var query = [ + // 'MATCH (user:User {facebookID: {facebookID}})', + // 'MATCH (checkin:Checkin {checkinID: {checkinID}})', + // 'MATCH (user)-[rel:hasBucket]->(checkin)', + // 'DELETE rel' + 'match (user:User {facebookID: {facebookID}})-[rel:hasBucket]->(checkin:Checkin {checkinID: {checkinID}})delete rel' + ].join('\n'); + + var params = { facebookID: facebookID, checkinID: checkinID }; + console.log(params); db.query(query, params, function (err, results) { if (err) { deferred.reject(err); } else { deferred.resolve(results); + console.log('query executed!') } }); diff --git a/server/api/checkins/checkinRoutes.js b/server/api/checkins/checkinRoutes.js index 6eab550..bb4af08 100644 --- a/server/api/checkins/checkinRoutes.js +++ b/server/api/checkins/checkinRoutes.js @@ -10,6 +10,7 @@ module.exports = function (app) { //Routes for user actions app.post('/bucketlist', checkinController.addToBucketList); + app.post('/removebucket', checkinController.removeFromBucketList) app.post('/comment', checkinController.addComment); app.post('/props', checkinController.giveProps); app.get('/interactions/:checkinid', checkinController.getPropsAndComments); From 7c93bd9c3603d409458312ba64e31262dafa4424 Mon Sep 17 00:00:00 2001 From: ashruti Date: Wed, 8 Oct 2014 15:05:38 -0400 Subject: [PATCH 02/41] Code comments added --- Gruntfile.js | 4 ++-- client/app/app.js | 9 +++++++-- client/app/modules/pages/frontpage/frontpage.html | 5 +++++ client/app/modules/pages/frontpage/frontpage.js | 9 ++++++++- client/app/modules/pages/map/friends.js | 4 +++- client/app/modules/pages/map/map.js | 1 + client/app/modules/pages/partials/navbar.js | 1 + client/app/modules/services.js | 1 + client/app/modules/services/auth.js | 3 ++- client/index.html | 13 +++++++++++++ 10 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ada6f7e..c7101bb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -118,10 +118,10 @@ module.exports = function (grunt) { nodemon.stdout.pipe(process.stdout); nodemon.stderr.pipe(process.stderr); - grunt.task.run(['clean', 'concat:bower', 'concat:client', 'stylus', 'uglify:dev', 'watch']); + grunt.task.run(['clean', 'concat:bower', 'concat:client', 'stylus', 'uglify:dev' , 'watch']); }); - grunt.registerTask('build', ['clean', 'bower', 'concat:bower', 'concat:client', 'stylus', 'uglify:build']); + grunt.registerTask('build', ['clean', 'bower', 'concat:bower', 'concat:client', 'stylus','uglify:build']); grunt.registerTask('test', ['mochaTest']); }; diff --git a/client/app/app.js b/client/app/app.js index 85343be..7fedd20 100644 --- a/client/app/app.js +++ b/client/app/app.js @@ -1,7 +1,11 @@ +// The applcations states are created using ui-router . +//Here the controller,templateURL that each state uses are specified too. + (function(){ -'use strict'; +'use strict'; var WaddleConfig = function ($stateProvider, $urlRouterProvider) { + //creates an application state $stateProvider .state('frontpage', { url: '/', @@ -48,10 +52,11 @@ var WaddleConfig = function ($stateProvider, $urlRouterProvider) { templateUrl: '../app/modules/pages/map/footprints.html', controller: 'FeedController as mapFootprints' }) - +//when none of the above state match the URL then redirect the page to state represented by '/' $urlRouterProvider.otherwise('/'); }; +//All the depenedent modules in the app are registered . Through config method application states are configired . angular.module('waddle', [ 'waddle.controllers', 'waddle.directives', diff --git a/client/app/modules/pages/frontpage/frontpage.html b/client/app/modules/pages/frontpage/frontpage.html index f2fd741..a17f64d 100644 --- a/client/app/modules/pages/frontpage/frontpage.html +++ b/client/app/modules/pages/frontpage/frontpage.html @@ -8,7 +8,12 @@

Waddle

+<<<<<<< Updated upstream

Your world. Your footprints.

+======= +

Your world. Your footprints. Your Home . Your Life :):)

+ +>>>>>>> Stashed changes

diff --git a/client/app/modules/pages/frontpage/frontpage.js b/client/app/modules/pages/frontpage/frontpage.js index 8dc6354..c490a45 100644 --- a/client/app/modules/pages/frontpage/frontpage.js +++ b/client/app/modules/pages/frontpage/frontpage.js @@ -1,3 +1,4 @@ + (function(){ var FrontpageController = function (UserRequests, $scope, $state) { @@ -11,6 +12,7 @@ var FrontpageController = function (UserRequests, $scope, $state) { }); }; + var sendUserDataToServer = function(fbToken, fbData){ window.sessionStorage.userFbID = fbData.id; @@ -19,16 +21,18 @@ var FrontpageController = function (UserRequests, $scope, $state) { name: fbData.name, fbToken: fbToken }; - +//when sucessfully connected to fb account , loading screen is made active $state.go('loading'); UserRequests.sendUserData(userData) .then(function(storedUserData){ UserRequests.allData = storedUserData.data + //Here map state is set to active $state.go('map'); }); }; +//gets login status of the facebook account openFB.getLoginStatus(function (response){ if (response.status === 'connected'){ console.log('connected'); @@ -38,6 +42,7 @@ var FrontpageController = function (UserRequests, $scope, $state) { } }); +//when user clicks lets waddle this function is invoked which calls facebook login function in return $scope.login = function(){ openFB.login(function (response) { if(response.status === 'connected') { @@ -47,11 +52,13 @@ var FrontpageController = function (UserRequests, $scope, $state) { alert('Facebook login failed: ' + response.error); } }, { + //to tell fb that these information of the user will be accessed scope: 'user_friends, user_tagged_places, user_photos, read_stream' }); }; }; +//Injects the services needed by the controller FrontpageController.$inject = ['UserRequests', '$scope', '$state'] //Start creating Angular module diff --git a/client/app/modules/pages/map/friends.js b/client/app/modules/pages/map/friends.js index f4ac9d7..1d90387 100644 --- a/client/app/modules/pages/map/friends.js +++ b/client/app/modules/pages/map/friends.js @@ -6,7 +6,7 @@ var FriendsController = function ($scope, $state, UserRequests, MapFactory) { $scope.allUserFriends = UserRequests.allData.friends; console.log($scope.allUserFriends); } - +//when the location map for a friend is request , this method get the data of the friend and builds the quadtree representing friend data on the map $scope.clickFriend = function (friend) { var viewer = window.sessionStorage.userFbID; UserRequests.getUserData(friend, viewer) @@ -17,8 +17,10 @@ var FriendsController = function ($scope, $state, UserRequests, MapFactory) { }; }; +//Injects all the dependencies needed by FriendController FriendsController.$inject = ['$scope', '$state', 'UserRequests', 'MapFactory']; +//Creates module waddle.friends and registers the controller function to it angular.module('waddle.friends', []) .controller('FriendsController', FriendsController); diff --git a/client/app/modules/pages/map/map.js b/client/app/modules/pages/map/map.js index 41b70b7..ec81e39 100644 --- a/client/app/modules/pages/map/map.js +++ b/client/app/modules/pages/map/map.js @@ -27,6 +27,7 @@ var MapController = function (Auth, UserRequests, MapFactory, $scope, $state, $s }); } +// Inject all the depependent services needed by the controller MapController.$inject = ['Auth', 'UserRequests', 'MapFactory', '$scope', '$state', '$stateParams', '$rootScope']; //Start creating Angular module diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index 4f0bcdd..c0ade72 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -32,6 +32,7 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact ]; } +//Inject all the dependent services needed by the controller NavbarController.$inject = ['Auth', '$rootScope', '$scope', 'UserRequests', 'MapFactory', '$state']; angular.module('waddle.navbar', []) diff --git a/client/app/modules/services.js b/client/app/modules/services.js index de90683..22bc3b7 100644 --- a/client/app/modules/services.js +++ b/client/app/modules/services.js @@ -1,3 +1,4 @@ +//create module and configure all the services of the application (function() { angular.module('waddle.services', ['waddle.services.auth', 'waddle.services.mapFactory', 'waddle.services.userRequestsFactory', 'waddle.services.footprintRequestsFactory']); })(); diff --git a/client/app/modules/services/auth.js b/client/app/modules/services/auth.js index f0b07e8..6eb0363 100644 --- a/client/app/modules/services/auth.js +++ b/client/app/modules/services/auth.js @@ -23,8 +23,9 @@ var Auth = function ($q, $state){ window.sessionStorage.clear(); window.localStorage.clear(); + - $state.go('frontpage'); + $state.go('frontpage',{},{reload: true}); }; return { diff --git a/client/index.html b/client/index.html index 44bbb82..56a9e6c 100644 --- a/client/index.html +++ b/client/index.html @@ -9,14 +9,27 @@ + + + + + + +
+<<<<<<< Updated upstream +======= + + + +>>>>>>> Stashed changes \ No newline at end of file From 50eb9cfe05d0a1ac78a019c98f3afe17d6f4c289 Mon Sep 17 00:00:00 2001 From: byeo630 Date: Wed, 8 Oct 2014 19:08:51 -0400 Subject: [PATCH 03/41] Add bootstrap navbar. Add transparency to the feed and navbar. --- client/app/modules/pages/map/feed.html | 1 + client/app/modules/pages/map/footprint.html | 6 +-- client/app/modules/pages/partials/navbar.html | 52 ++++++++++++++++--- client/styles/styles.styl | 24 +++++++-- 4 files changed, 69 insertions(+), 14 deletions(-) diff --git a/client/app/modules/pages/map/feed.html b/client/app/modules/pages/map/feed.html index 49c477f..0ae4aba 100644 --- a/client/app/modules/pages/map/feed.html +++ b/client/app/modules/pages/map/feed.html @@ -1,5 +1,6 @@
+

Feed

{{footprint.place.name}} diff --git a/client/app/modules/pages/map/footprint.html b/client/app/modules/pages/map/footprint.html index 3f1adfb..031b862 100644 --- a/client/app/modules/pages/map/footprint.html +++ b/client/app/modules/pages/map/footprint.html @@ -1,5 +1,5 @@
- X + x

{{footprint.place.name}}

"{{footprint.checkin.caption}}"

@@ -7,9 +7,9 @@

"{{footprint.checkin.caption}}"
- +

Be the first to comment!

diff --git a/client/app/modules/pages/partials/navbar.html b/client/app/modules/pages/partials/navbar.html index 52e1a99..2600ba5 100644 --- a/client/app/modules/pages/partials/navbar.html +++ b/client/app/modules/pages/partials/navbar.html @@ -1,4 +1,45 @@ - -->

diff --git a/client/styles/styles.styl b/client/styles/styles.styl index 47f9fae..a2fc002 100644 --- a/client/styles/styles.styl +++ b/client/styles/styles.styl @@ -267,7 +267,7 @@ li{ } .waddlelogo { - margin:5px; + margin: 0px; width:25px; height:auto; } @@ -364,7 +364,8 @@ li{ .navbarprofile { float: right; - margin-right: 10px; + margin-top: auto; + margin-bottom: auto; } .navbarprofile img { @@ -374,17 +375,30 @@ li{ height: 25px; } +.navbar-default { + background-color: rgba(255,255,255,0.5); +} + +.active { + opacity: 0.8; + border-radius: 5px; +} + .waddlefeed { - margin-top: 40px; + margin-top: 10px; margin-right: 10px; height: 50em; width: 275px; float: right; border-radius:5px; - background-color:rgba(255,255,255,0.9); + background-color:rgba(255,255,255,0.5); overflow-y: scroll; } +.feedtitle { + margin-left: 10px; +} + .defaultpeng { -webkit-filter: grayscale(50%); -moz-filter: grayscale(80%); @@ -478,7 +492,7 @@ li{ min-height: 300px; min-width: 300px; max-height: 750px; - border-radius: 5px; + border-radius: 10px; overflow-y: scroll; position: absolute; background-color: rgba(255,255,255,0.9); From ae8610bb26539dadc0c12efe1584c69f99b21205 Mon Sep 17 00:00:00 2001 From: byeo630 Date: Fri, 10 Oct 2014 10:25:53 -0400 Subject: [PATCH 04/41] Add styling to footprint window. --- client/app/modules/pages/map/footprint.html | 60 ++++++++++--------- client/app/modules/pages/partials/navbar.html | 23 +++++-- client/app/modules/pages/partials/navbar.js | 6 +- client/styles/styles.styl | 21 +++++-- 4 files changed, 71 insertions(+), 39 deletions(-) diff --git a/client/app/modules/pages/map/footprint.html b/client/app/modules/pages/map/footprint.html index 031b862..04a7784 100644 --- a/client/app/modules/pages/map/footprint.html +++ b/client/app/modules/pages/map/footprint.html @@ -1,29 +1,35 @@ -
- x -

{{footprint.place.name}}

-

"{{footprint.checkin.caption}}"

- - -
- - - -
-
-

Be the first to comment!

-
- - 120 Character Max -
-
-
-
- +
+
+ x +
+ + +
+
+
+

{{footprint.place.name}}

+

"{{footprint.checkin.caption}}"

+ + + +
+
+
+ +
+

{{comment.comment.text}}

+ {{comment.comment.time | date : shortDate}} +

{{comment.commenter.name}}

+
+
+

Be the first to comment!

+
+ + 120 Character Max +
+
-

{{comment.comment.text}}

- {{comment.comment.time | date : shortDate}} -

{{comment.commenter.name}}

-
+
\ No newline at end of file diff --git a/client/app/modules/pages/partials/navbar.html b/client/app/modules/pages/partials/navbar.html index 2600ba5..d7f2af9 100644 --- a/client/app/modules/pages/partials/navbar.html +++ b/client/app/modules/pages/partials/navbar.html @@ -25,16 +25,24 @@
@@ -64,6 +72,11 @@
{{name}}
--> + + + + + diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index 2751885..2e08198 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -24,11 +24,11 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact // var myDropdown = $dropdown(element, {title: 'blah', content: 'bsadsda'}); $scope.dropdown = [ - {"text": "

Friends

", "ui-sref": "map.friends"}, - {"text": '

 Display an alert', click: '$alert("Holy guacamole!")'}, + {"text": '

 Friends', ui-sref: 'map.friends'}, + {"text": '

 Add Social', ui-sref: 'map.providers'}, {"text": ' External link', href: '/auth/facebook', target: '_self'}, {divider: true}, - {"text": 'Separated link', href: '#separatedLink'} + {"text": 'Log out', 'ng-click': 'logout()'} ]; } diff --git a/client/styles/styles.styl b/client/styles/styles.styl index a2fc002..6e994a5 100644 --- a/client/styles/styles.styl +++ b/client/styles/styles.styl @@ -484,19 +484,32 @@ li{ overflow-y: scroll; } - .footprintitem { - top: 50px; - margin: 10px; + top: 80px; + margin-right: auto; + margin-left: auto; padding: 5px; min-height: 300px; min-width: 300px; max-height: 750px; + max-width: 1000px; border-radius: 10px; overflow-y: scroll; - position: absolute; + position: fixed; background-color: rgba(255,255,255,0.9); z-index: 1; + margin-left: 50px; +} + +.footprintpicture{ + margin-right: auto; + margin-left: auto; + max-width: 700px; + max-height: 700px; +} + +.footprint-pic-bg{ + background-color: #000; } .closefootprint { From 0cfd41a5df3d6fdb269363c0546f1505599e3a3d Mon Sep 17 00:00:00 2001 From: Vishal Reddy Date: Fri, 10 Oct 2014 12:09:50 -0400 Subject: [PATCH 05/41] Add function to aggregate different users' footprints to userController; create API route to call aggregated feed; add navbar function to call route --- .../modules/pages/frontpage/frontpage.html | 6 +-- client/app/modules/pages/map/friends.js | 2 +- client/app/modules/pages/map/map.js | 2 +- client/app/modules/pages/partials/navbar.html | 1 + client/app/modules/pages/partials/navbar.js | 13 +++++ client/app/modules/services/mapFactory.js | 2 +- .../modules/services/userRequestsFactory.js | 9 ++++ client/index.html | 6 --- server/api/users/userController.js | 53 ++++++++++++++++++- server/api/users/userModel.js | 19 +++++-- server/api/users/userRoutes.js | 4 +- 11 files changed, 98 insertions(+), 19 deletions(-) diff --git a/client/app/modules/pages/frontpage/frontpage.html b/client/app/modules/pages/frontpage/frontpage.html index a17f64d..97ae508 100644 --- a/client/app/modules/pages/frontpage/frontpage.html +++ b/client/app/modules/pages/frontpage/frontpage.html @@ -8,12 +8,8 @@

Waddle

-<<<<<<< Updated upstream

Your world. Your footprints.

-======= -

Your world. Your footprints. Your Home . Your Life :):)

- ->>>>>>> Stashed changes +
diff --git a/client/app/modules/pages/map/friends.js b/client/app/modules/pages/map/friends.js index 1d90387..daf9830 100644 --- a/client/app/modules/pages/map/friends.js +++ b/client/app/modules/pages/map/friends.js @@ -6,7 +6,7 @@ var FriendsController = function ($scope, $state, UserRequests, MapFactory) { $scope.allUserFriends = UserRequests.allData.friends; console.log($scope.allUserFriends); } -//when the location map for a friend is request , this method get the data of the friend and builds the quadtree representing friend data on the map +//gets friend data and builds quadtree representing friend data on the map $scope.clickFriend = function (friend) { var viewer = window.sessionStorage.userFbID; UserRequests.getUserData(friend, viewer) diff --git a/client/app/modules/pages/map/map.js b/client/app/modules/pages/map/map.js index ec81e39..74793d8 100644 --- a/client/app/modules/pages/map/map.js +++ b/client/app/modules/pages/map/map.js @@ -18,7 +18,7 @@ var MapController = function (Auth, UserRequests, MapFactory, $scope, $state, $s if(UserRequests.allData) { $scope.currentMap = MapFactory.initializeMap(); - MapFactory.currentMap = $scope.currentMap; + // MapFactory.currentMap = $scope.currentMap; MapFactory.markerQuadTree = MapFactory.handleUserCheckinData(UserRequests.allData.allCheckins); $state.go('map.feed'); } else { diff --git a/client/app/modules/pages/partials/navbar.html b/client/app/modules/pages/partials/navbar.html index 52e1a99..7c82cda 100644 --- a/client/app/modules/pages/partials/navbar.html +++ b/client/app/modules/pages/partials/navbar.html @@ -13,6 +13,7 @@
{{name}}
  • friends
  • hype list
  • +
  • home
  • footprints
  • sign out
  • diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index 7e8b941..271c260 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -6,10 +6,12 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact $scope.loadBucketlist = function () { UserRequests.getBucketList(window.sessionStorage.userFbID) .then(function (BucketData) { + console.log(BucketData); // Because the navbar controller does not inherit the map or feed scope, // current map has to be retrieved from MapFactory. This is used to set the inbounds // immediately when 'my bucketlist' is clicked MapFactory.markerQuadTree = MapFactory.handleUserCheckinData(BucketData.data); + console.log(MapFactory.currentMap); var bounds = MapFactory.currentMap.getBounds() MapFactory.filterFeedByBounds(bounds) $state.go('map.feed'); @@ -21,6 +23,17 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact $scope.name = UserRequests.allData.name; } + $scope.loadAggregatedFootprints = function () { + UserRequests.getAggregatedFeedData(window.sessionStorage.userFbID) + .then(function (aggregatedFootprints) { + console.log(aggregatedFootprints.data[0]); + MapFactory.markerQuadTree = MapFactory.handleUserCheckinData(aggregatedFootprints.data[0]); + var bounds = MapFactory.currentMap.getBounds(); + MapFactory.filterFeedByBounds(bounds); + $state.go('map.feed'); + }); + }; + // var myDropdown = $dropdown(element, {title: 'blah', content: 'bsadsda'}); $scope.dropdown = [ diff --git a/client/app/modules/services/mapFactory.js b/client/app/modules/services/mapFactory.js index 8f001b5..0ed6dab 100644 --- a/client/app/modules/services/mapFactory.js +++ b/client/app/modules/services/mapFactory.js @@ -107,7 +107,7 @@ var MapFactory = function (){ var mapFactoryVars = { // Markers in bounds are stored on factory to be accessible from any state markerQuadTree: null, - currentMap: currentMap, + // currentMap: currentMap, // Share data points in bounds accross different views. // Mainly added to account for navbar's need for inbounds data currentInBounds: currentInBounds, diff --git a/client/app/modules/services/userRequestsFactory.js b/client/app/modules/services/userRequestsFactory.js index 3d03f0e..fb7532b 100644 --- a/client/app/modules/services/userRequestsFactory.js +++ b/client/app/modules/services/userRequestsFactory.js @@ -31,6 +31,15 @@ var UserRequests = function ($http){ } }, + getAggregatedFeedData:function (userFbID) { + if (userFbID) { + return $http({ + method: 'GET', + url: '/api/users/aggregatefeed/' + userFbID + }); + } + }, + getBucketList: function (userFbID) { if (userFbID) { return $http({ diff --git a/client/index.html b/client/index.html index 56a9e6c..d933bf3 100644 --- a/client/index.html +++ b/client/index.html @@ -20,16 +20,10 @@
    -<<<<<<< Updated upstream -======= - - - ->>>>>>> Stashed changes \ No newline at end of file diff --git a/server/api/users/userController.js b/server/api/users/userController.js index 697627b..fc746d4 100644 --- a/server/api/users/userController.js +++ b/server/api/users/userController.js @@ -229,7 +229,7 @@ userController.addInstagramData = function (req, res) { }; -// +//uses facebook ID to grab friend data when user navigates to friend page userController.getUserData = function (req, res){ var userData = { facebookID: req.params.friend @@ -251,6 +251,57 @@ userController.getUserData = function (req, res){ }); }; +userController.getAggregatedListOfCheckins = function (req, res){ + // var users = req.params.userlist; + var params = {}; + var aggregatedFootprints = []; + var friendCheckins; + params.facebookID = req.params.user; + + User.find(params) + .then(function (userNode) { + user = userNode + return user.findAllCheckins(params.facebookID); + }) + .then(function (userCheckins){ + aggregatedFootprints.push(userCheckins); + return user.findAllFriends(); + }) + .then(function (friendlist) { + _.each(friendlist, function(friend) { + User.find(friend) + .then(function (friendnode) { + return friendnode.findAllCheckins(params.facebookID); + }) + .then(function (friendCheckins) { + aggregatedFootprints.push(friendCheckins); + console.log('aggregated footprints', JSON.stringify(aggregatedFootprints)); + }) + }) + // if(aggregatedFootprints.length > 1) { + return aggregatedFootprints; + // } + }) + .then(function (aggregatedFootprints) { + console.log(aggregatedFootprints); + res.json(aggregatedFootprints); + res.status(200).end(); + }) + .catch(function (err) { + console.log(err); + res.status(500).end(); + }); +} + +userController.getAllFriendCheckins = function (container) { + var deferred = Q.defer(); + + + container.push() + + +} + // Takes a facebookID and returns a footprint object with // checkin and place keys, containing checkin and place data userController.getBucketList = function (req, res){ diff --git a/server/api/users/userModel.js b/server/api/users/userModel.js index 0158384..30519fa 100644 --- a/server/api/users/userModel.js +++ b/server/api/users/userModel.js @@ -232,10 +232,10 @@ User.prototype.findAllCheckins = function (viewer) { var deferred = Q.defer(); var query = [ - 'MATCH (user:User {facebookID: {facebookID}})-[:hasCheckin]->(checkin:Checkin)-[:hasPlace]->(p:Place)', + 'MATCH (user:User {facebookID: {facebookID}})-[:hasCheckin]->(checkin:Checkin)-[:hasPlace]->(place:Place)', (viewer ? 'OPTIONAL MATCH (liker:User {facebookID: {viewerID}})-[connection:givesProps]->(checkin)' + 'OPTIONAL MATCH (bucketer:User {facebookID: {viewerID}})-[:hasBucket]->(checkin)' : ""), - 'RETURN checkin, p' + (viewer ? ', liker, bucketer' : "") + 'RETURN user, checkin, place' + (viewer ? ', liker, bucketer' : "") ].join('\n'); var params = { @@ -251,8 +251,9 @@ User.prototype.findAllCheckins = function (viewer) { else { var parsedResults = _.map(results, function (item) { var singleResult = { + "user": item.user.data, "checkin": item.checkin.data, - "place": item.p.data + "place": item.place.data } if (item.liker){ singleResult.checkin.liked = true; @@ -270,6 +271,16 @@ User.prototype.findAllCheckins = function (viewer) { return deferred.promise; }; +//TO-DO: implement query to get all footprints associated with a user and their friends + +// User.getAggregatedFootprintList = function (viewer) { +// var deferred = Q.defer(); + +// var query = [ +// 'M' +// ] +// } + // Find all bucketList items for a user // Takes a facebookID and returns a footprint object with // checkin and place keys, containing checkin and place data @@ -312,6 +323,8 @@ User.getBucketList = function (facebookID){ // If user is not in database, promise will resolve to error 'user does not exist' User.find = function (data) { + console.log('model: ', JSON.stringify(data)); + var deferred = Q.defer(); var query = [ diff --git a/server/api/users/userRoutes.js b/server/api/users/userRoutes.js index 85755ca..3b4cafd 100644 --- a/server/api/users/userRoutes.js +++ b/server/api/users/userRoutes.js @@ -4,6 +4,8 @@ module.exports = function(app){ app.post('/userdata', userController.userLogin); app.post('/userfoursquarecode', userController.addFoursquareData); app.post('/userinstagramcode', userController.addInstagramData); - app.get('/bucketlist/:user', userController.getBucketList) + app.get('/bucketlist/:user', userController.getBucketList); + app.get('/aggregatefeed/:user', userController.getAggregatedListOfCheckins); + //the next line must be listed last because it catches all paths app.get('/:friend/:viewer', userController.getUserData); }; From 8bd19f7b0ccc3ada5781af020025fd8e50833a1c Mon Sep 17 00:00:00 2001 From: byeo630 Date: Mon, 13 Oct 2014 18:22:14 -0400 Subject: [PATCH 06/41] Style Feed date, name, place name, comment box, and photo. Fix centering issue in footprint modal photo. --- client/app/modules/pages/map/feed.html | 30 ++++++---- client/app/modules/pages/map/feed.js | 1 + client/app/modules/pages/map/footprint.html | 4 +- client/app/modules/pages/map/friends.html | 4 +- client/app/modules/pages/partials/navbar.js | 15 ++--- client/styles/styles.styl | 65 +++++++++++++-------- 6 files changed, 73 insertions(+), 46 deletions(-) diff --git a/client/app/modules/pages/map/feed.html b/client/app/modules/pages/map/feed.html index 07643e2..9148f11 100644 --- a/client/app/modules/pages/map/feed.html +++ b/client/app/modules/pages/map/feed.html @@ -2,21 +2,27 @@

    Feed

    -

    - {{footprint.place.name}} -

    - - + +

    {{footprint.user.name}}

    + + + {{footprint.checkin.checkinTime | date : shortDate}}
    - {{footprint.checkin.checkinTime | date : shortDate}} -
    - +

    + {{footprint.place.name}} +

    +
    + +

    {{footprint.checkin.caption}}

    +
    +
    +
    -
    - +
    +
    -
    -

    "{{footprint.checkin.caption}}"

    +
    +

    "{{footprint.checkin.caption}}"

    diff --git a/client/app/modules/pages/map/feed.js b/client/app/modules/pages/map/feed.js index 8d2b23b..eb7e5a5 100644 --- a/client/app/modules/pages/map/feed.js +++ b/client/app/modules/pages/map/feed.js @@ -17,6 +17,7 @@ var FeedController = function (MapFactory, FootprintRequests, Auth, $scope, $roo $scope.$apply(function(){ MapFactory.filterFeedByBounds($scope.currentMap.getBounds()) }); + console.log($scope.inBoundsObject); }); } diff --git a/client/app/modules/pages/map/footprint.html b/client/app/modules/pages/map/footprint.html index 6d02a9c..672968a 100644 --- a/client/app/modules/pages/map/footprint.html +++ b/client/app/modules/pages/map/footprint.html @@ -7,6 +7,8 @@
    + +

    {{footprint.user.name}}

    {{footprint.place.name}}

    "{{footprint.checkin.caption}}"

    @@ -17,7 +19,7 @@

    {{selectedFootprintInteractions.props}}

    -->
    - +

    {{comment.commenter.name}}

    {{comment.comment.time | date : shortDate}} diff --git a/client/app/modules/pages/map/friends.html b/client/app/modules/pages/map/friends.html index 15e4e04..1cdee45 100644 --- a/client/app/modules/pages/map/friends.html +++ b/client/app/modules/pages/map/friends.html @@ -3,8 +3,6 @@
    -

    - {{friend.name}} -

    +

    {{friend.name}}

    diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index 9ec4307..c6de5e4 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -24,6 +24,7 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact } $scope.loadAggregatedFootprints = function () { + console.log("hi"); UserRequests.getAggregatedFeedData(window.sessionStorage.userFbID) .then(function (aggregatedFootprints) { console.log(aggregatedFootprints.data[0]); @@ -36,13 +37,13 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact // var myDropdown = $dropdown(element, {title: 'blah', content: 'bsadsda'}); - $scope.dropdown = [ - {"text": '

     Friends', ui-sref: 'map.friends'}, - {"text": '

     Add Social', ui-sref: 'map.providers'}, - {"text": ' External link', href: '/auth/facebook', target: '_self'}, - {divider: true}, - {"text": 'Log out', 'ng-click': 'logout()'} - ]; + // $scope.dropdown = [ + // {"text": '

     Friends', "ui-sref": 'map.friends'}, + // {"text": '

     Add Social', "ui-sref": 'map.providers'}, + // {"text": ' External link', href: '/auth/facebook', target: '_self'}, + // {divider: true}, + // {"text": 'Log out', 'ng-click': 'logout()'} + // ]; } //Inject all the dependent services needed by the controller diff --git a/client/styles/styles.styl b/client/styles/styles.styl index 889035a..820fdbd 100644 --- a/client/styles/styles.styl +++ b/client/styles/styles.styl @@ -423,12 +423,21 @@ li{ } .feeditemname { - display: inline-block; - white-space: nowrap; + display: inline; + white-space: normal; width: 77%; overflow: hidden; text-overflow: ellipsis; cursor: pointer; + font-weight: 400; + font-size: 20px; + margin: 0px; + padding: 0px; +} + +.checkindate{ + float: right; + margin-right: 10px; } .feedphoto { @@ -439,8 +448,9 @@ li{ text-align:center; cursor: pointer; background-position: center; - border-radius: 5px; - padding: 5px; + border: 1px solid #e6e6e6; + border-radius: 10px; + margin-bottom: 10px; } .footprintbrick { @@ -452,12 +462,12 @@ li{ height: 17%; background-color: #fff; margin: 5px; + width: auto; + border-radius: 10px; } .friendname { - position: relative; - left: 130px; - top: -67px; + display: inline-block; cursor:pointer; } @@ -465,16 +475,6 @@ li{ color: Teal; } -.friendphoto { - cursor: pointer; - display: inline; - margin: 5px; - border-radius: 3px; - overflow: hidden; - width: 95px; - max-height: 95px; -} - .footprints { margin-top: 60px; margin-left: 50px; @@ -502,14 +502,16 @@ li{ } .footprintpicture{ - margin-right: auto; - margin-left: auto; max-width: 700px; max-height: 700px; + margin-left: auto; + margin-right: auto; } .footprint-pic-bg{ background-color: #000; + border-radius: 10px + text-align: center; } .closefootprint { @@ -531,9 +533,26 @@ li{ .footprintcommentpic { width: 70px; + border-radius: 10px; height: auto; } +.footprintprofpic { + width: 40px; + height: 40px; + border-radius: 10px; + overflow: hidden; +} + +.friendphoto { + width: 95px; + height: 95px; + border-radius: 10px; + overflow: hidden; + display: inline; + margin: 5px; +} + .commentername { display: block; } @@ -579,11 +598,11 @@ li{ .comment_form input { position: relative; - height:24px; - width:245px; + height:26px; + width: 100%; padding:5px; - box-shadow: 0px 0px 3px #ccc, 0 10px 15px #eee inset; - border-radius: 3px; + box-shadow: 0px 0px 3px #ccc inset; + border-radius: 5px; border: none; } From d288411a8a8e12321d72f7df3794c9ba5a3e7cea Mon Sep 17 00:00:00 2001 From: byeo630 Date: Mon, 13 Oct 2014 18:25:39 -0400 Subject: [PATCH 07/41] Center loading image. --- client/app/modules/pages/providers/loading.html | 4 +++- client/styles/styles.styl | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/app/modules/pages/providers/loading.html b/client/app/modules/pages/providers/loading.html index cfa0a13..d845b47 100644 --- a/client/app/modules/pages/providers/loading.html +++ b/client/app/modules/pages/providers/loading.html @@ -1 +1,3 @@ - \ No newline at end of file +
    + +
    \ No newline at end of file diff --git a/client/styles/styles.styl b/client/styles/styles.styl index 820fdbd..657e702 100644 --- a/client/styles/styles.styl +++ b/client/styles/styles.styl @@ -266,6 +266,15 @@ li{ background-color: #505050 } +.loading{ + text-align: center; +} + +.loadingimg{ + margin-right: auto; + margin-left: auto; +} + .waddlelogo { margin: 0px; width:25px; From 3fd11a200e0cd51bf031fa5fe04bae95ca1cd677 Mon Sep 17 00:00:00 2001 From: byeo630 Date: Mon, 13 Oct 2014 18:52:14 -0400 Subject: [PATCH 08/41] Take out console.log. --- client/app/modules/pages/partials/navbar.js | 2 -- client/styles/styles.styl | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index c6de5e4..5fb9178 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -11,7 +11,6 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact // current map has to be retrieved from MapFactory. This is used to set the inbounds // immediately when 'my bucketlist' is clicked MapFactory.markerQuadTree = MapFactory.handleUserCheckinData(BucketData.data); - console.log(MapFactory.currentMap); var bounds = MapFactory.currentMap.getBounds() MapFactory.filterFeedByBounds(bounds) $state.go('map.feed'); @@ -24,7 +23,6 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact } $scope.loadAggregatedFootprints = function () { - console.log("hi"); UserRequests.getAggregatedFeedData(window.sessionStorage.userFbID) .then(function (aggregatedFootprints) { console.log(aggregatedFootprints.data[0]); diff --git a/client/styles/styles.styl b/client/styles/styles.styl index 657e702..fedb6ad 100644 --- a/client/styles/styles.styl +++ b/client/styles/styles.styl @@ -271,6 +271,8 @@ li{ } .loadingimg{ + margin-top: auto; + margin-bottom: auto; margin-right: auto; margin-left: auto; } @@ -439,7 +441,6 @@ li{ text-overflow: ellipsis; cursor: pointer; font-weight: 400; - font-size: 20px; margin: 0px; padding: 0px; } From 16b8a14b2d8dfb9a76498a93de92caa977110bd5 Mon Sep 17 00:00:00 2001 From: Vishal Reddy Date: Mon, 13 Oct 2014 18:58:09 -0400 Subject: [PATCH 09/41] Comment out broken dropdown code in navbar.js --- client/app/modules/pages/partials/navbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/app/modules/pages/partials/navbar.js b/client/app/modules/pages/partials/navbar.js index 9ec4307..d8b6fb3 100644 --- a/client/app/modules/pages/partials/navbar.js +++ b/client/app/modules/pages/partials/navbar.js @@ -37,8 +37,8 @@ var NavbarController = function (Auth, $rootScope, $scope, UserRequests, MapFact // var myDropdown = $dropdown(element, {title: 'blah', content: 'bsadsda'}); $scope.dropdown = [ - {"text": '

     Friends', ui-sref: 'map.friends'}, - {"text": '

     Add Social', ui-sref: 'map.providers'}, + {"text": '

     Friends', "ui-sref": 'map.friends'}, + {"text": '

     Add Social', "ui-sref": 'map.providers'}, {"text": ' External link', href: '/auth/facebook', target: '_self'}, {divider: true}, {"text": 'Log out', 'ng-click': 'logout()'} From efbd0fa1a88719b5236a68ee514dcb2f3e853ef5 Mon Sep 17 00:00:00 2001 From: Vishal Reddy Date: Tue, 14 Oct 2014 15:44:40 -0400 Subject: [PATCH 10/41] Add dropdown functionality to navbar --- client/app/modules/pages/partials/navbar.html | 4 ++-- client/app/modules/pages/partials/navbar.js | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/client/app/modules/pages/partials/navbar.html b/client/app/modules/pages/partials/navbar.html index fa881f9..9fafd57 100644 --- a/client/app/modules/pages/partials/navbar.html +++ b/client/app/modules/pages/partials/navbar.html @@ -32,8 +32,8 @@
  • {{name}}
  • - +