diff --git a/app/www/img/asking.png b/app/www/img/asking.png index b7c8440..4a03480 100644 Binary files a/app/www/img/asking.png and b/app/www/img/asking.png differ diff --git a/app/www/img/avatars/anteater.png b/app/www/img/avatars/anteater.png new file mode 100644 index 0000000..798416a Binary files /dev/null and b/app/www/img/avatars/anteater.png differ diff --git a/app/www/img/avatars/bat.png b/app/www/img/avatars/bat.png new file mode 100644 index 0000000..0516c08 Binary files /dev/null and b/app/www/img/avatars/bat.png differ diff --git a/app/www/img/avatars/beetle.png b/app/www/img/avatars/beetle.png new file mode 100644 index 0000000..0f9bd08 Binary files /dev/null and b/app/www/img/avatars/beetle.png differ diff --git a/app/www/img/avatars/bulldog.png b/app/www/img/avatars/bulldog.png new file mode 100644 index 0000000..a40bf36 Binary files /dev/null and b/app/www/img/avatars/bulldog.png differ diff --git a/app/www/img/avatars/butterfly.png b/app/www/img/avatars/butterfly.png new file mode 100644 index 0000000..e880707 Binary files /dev/null and b/app/www/img/avatars/butterfly.png differ diff --git a/app/www/img/avatars/camel.png b/app/www/img/avatars/camel.png new file mode 100644 index 0000000..dedf394 Binary files /dev/null and b/app/www/img/avatars/camel.png differ diff --git a/app/www/img/avatars/cat.png b/app/www/img/avatars/cat.png new file mode 100644 index 0000000..2da894e Binary files /dev/null and b/app/www/img/avatars/cat.png differ diff --git a/app/www/img/avatars/chameleon.png b/app/www/img/avatars/chameleon.png new file mode 100644 index 0000000..91f30f6 Binary files /dev/null and b/app/www/img/avatars/chameleon.png differ diff --git a/app/www/img/avatars/clown-fish.png b/app/www/img/avatars/clown-fish.png new file mode 100644 index 0000000..2473fcc Binary files /dev/null and b/app/www/img/avatars/clown-fish.png differ diff --git a/app/www/img/avatars/cobra.png b/app/www/img/avatars/cobra.png new file mode 100644 index 0000000..bdede1f Binary files /dev/null and b/app/www/img/avatars/cobra.png differ diff --git a/app/www/img/avatars/cow.png b/app/www/img/avatars/cow.png new file mode 100644 index 0000000..36c0ab0 Binary files /dev/null and b/app/www/img/avatars/cow.png differ diff --git a/app/www/img/avatars/crab.png b/app/www/img/avatars/crab.png new file mode 100644 index 0000000..673710d Binary files /dev/null and b/app/www/img/avatars/crab.png differ diff --git a/app/www/img/avatars/crocodile.png b/app/www/img/avatars/crocodile.png new file mode 100644 index 0000000..a0cc9fb Binary files /dev/null and b/app/www/img/avatars/crocodile.png differ diff --git a/app/www/img/avatars/duck.png b/app/www/img/avatars/duck.png new file mode 100644 index 0000000..2c48212 Binary files /dev/null and b/app/www/img/avatars/duck.png differ diff --git a/app/www/img/avatars/elephant.png b/app/www/img/avatars/elephant.png new file mode 100644 index 0000000..8fc8238 Binary files /dev/null and b/app/www/img/avatars/elephant.png differ diff --git a/app/www/img/avatars/frog.png b/app/www/img/avatars/frog.png new file mode 100644 index 0000000..c41de7c Binary files /dev/null and b/app/www/img/avatars/frog.png differ diff --git a/app/www/img/avatars/giraffe.png b/app/www/img/avatars/giraffe.png new file mode 100644 index 0000000..178bfcc Binary files /dev/null and b/app/www/img/avatars/giraffe.png differ diff --git a/app/www/img/avatars/hen.png b/app/www/img/avatars/hen.png new file mode 100644 index 0000000..7bd5bbf Binary files /dev/null and b/app/www/img/avatars/hen.png differ diff --git a/app/www/img/avatars/hippopotamus.png b/app/www/img/avatars/hippopotamus.png new file mode 100644 index 0000000..b8987cf Binary files /dev/null and b/app/www/img/avatars/hippopotamus.png differ diff --git a/app/www/img/avatars/kangaroo.png b/app/www/img/avatars/kangaroo.png new file mode 100644 index 0000000..c73debf Binary files /dev/null and b/app/www/img/avatars/kangaroo.png differ diff --git a/app/www/img/avatars/lion.png b/app/www/img/avatars/lion.png new file mode 100644 index 0000000..3865da6 Binary files /dev/null and b/app/www/img/avatars/lion.png differ diff --git a/app/www/img/avatars/llama.png b/app/www/img/avatars/llama.png new file mode 100644 index 0000000..d02bfef Binary files /dev/null and b/app/www/img/avatars/llama.png differ diff --git a/app/www/img/avatars/macaw.png b/app/www/img/avatars/macaw.png new file mode 100644 index 0000000..d8306a6 Binary files /dev/null and b/app/www/img/avatars/macaw.png differ diff --git a/app/www/img/avatars/monkey.png b/app/www/img/avatars/monkey.png new file mode 100644 index 0000000..433176d Binary files /dev/null and b/app/www/img/avatars/monkey.png differ diff --git a/app/www/img/avatars/moose.png b/app/www/img/avatars/moose.png new file mode 100644 index 0000000..cbae9e8 Binary files /dev/null and b/app/www/img/avatars/moose.png differ diff --git a/app/www/img/avatars/mouse.png b/app/www/img/avatars/mouse.png new file mode 100644 index 0000000..1d6d69a Binary files /dev/null and b/app/www/img/avatars/mouse.png differ diff --git a/app/www/img/avatars/octopus.png b/app/www/img/avatars/octopus.png new file mode 100644 index 0000000..427c31c Binary files /dev/null and b/app/www/img/avatars/octopus.png differ diff --git a/app/www/img/avatars/ostrich.png b/app/www/img/avatars/ostrich.png new file mode 100644 index 0000000..e4497e4 Binary files /dev/null and b/app/www/img/avatars/ostrich.png differ diff --git a/app/www/img/avatars/owl.png b/app/www/img/avatars/owl.png new file mode 100644 index 0000000..732dc88 Binary files /dev/null and b/app/www/img/avatars/owl.png differ diff --git a/app/www/img/avatars/panda.png b/app/www/img/avatars/panda.png new file mode 100644 index 0000000..e06893c Binary files /dev/null and b/app/www/img/avatars/panda.png differ diff --git a/app/www/img/avatars/pelican.png b/app/www/img/avatars/pelican.png new file mode 100644 index 0000000..547041f Binary files /dev/null and b/app/www/img/avatars/pelican.png differ diff --git a/app/www/img/avatars/penguin.png b/app/www/img/avatars/penguin.png new file mode 100644 index 0000000..295e7f1 Binary files /dev/null and b/app/www/img/avatars/penguin.png differ diff --git a/app/www/img/avatars/pig.png b/app/www/img/avatars/pig.png new file mode 100644 index 0000000..1f3f237 Binary files /dev/null and b/app/www/img/avatars/pig.png differ diff --git a/app/www/img/avatars/rabbit.png b/app/www/img/avatars/rabbit.png new file mode 100644 index 0000000..cf23843 Binary files /dev/null and b/app/www/img/avatars/rabbit.png differ diff --git a/app/www/img/avatars/racoon.png b/app/www/img/avatars/racoon.png new file mode 100644 index 0000000..c4d3418 Binary files /dev/null and b/app/www/img/avatars/racoon.png differ diff --git a/app/www/img/avatars/ray.png b/app/www/img/avatars/ray.png new file mode 100644 index 0000000..f421efd Binary files /dev/null and b/app/www/img/avatars/ray.png differ diff --git a/app/www/img/avatars/rhinoceros.png b/app/www/img/avatars/rhinoceros.png new file mode 100644 index 0000000..0d2601e Binary files /dev/null and b/app/www/img/avatars/rhinoceros.png differ diff --git a/app/www/img/avatars/sea-cow.png b/app/www/img/avatars/sea-cow.png new file mode 100644 index 0000000..6585715 Binary files /dev/null and b/app/www/img/avatars/sea-cow.png differ diff --git a/app/www/img/avatars/shark.png b/app/www/img/avatars/shark.png new file mode 100644 index 0000000..24804b7 Binary files /dev/null and b/app/www/img/avatars/shark.png differ diff --git a/app/www/img/avatars/sheep.png b/app/www/img/avatars/sheep.png new file mode 100644 index 0000000..451bfde Binary files /dev/null and b/app/www/img/avatars/sheep.png differ diff --git a/app/www/img/avatars/siberian-husky.png b/app/www/img/avatars/siberian-husky.png new file mode 100644 index 0000000..9de786f Binary files /dev/null and b/app/www/img/avatars/siberian-husky.png differ diff --git a/app/www/img/avatars/sloth.png b/app/www/img/avatars/sloth.png new file mode 100644 index 0000000..2f7322a Binary files /dev/null and b/app/www/img/avatars/sloth.png differ diff --git a/app/www/img/avatars/snake.png b/app/www/img/avatars/snake.png new file mode 100644 index 0000000..19567d9 Binary files /dev/null and b/app/www/img/avatars/snake.png differ diff --git a/app/www/img/avatars/spider.png b/app/www/img/avatars/spider.png new file mode 100644 index 0000000..4c5fc5b Binary files /dev/null and b/app/www/img/avatars/spider.png differ diff --git a/app/www/img/avatars/squirrel.png b/app/www/img/avatars/squirrel.png new file mode 100644 index 0000000..f4afbd3 Binary files /dev/null and b/app/www/img/avatars/squirrel.png differ diff --git a/app/www/img/avatars/swan.png b/app/www/img/avatars/swan.png new file mode 100644 index 0000000..713525a Binary files /dev/null and b/app/www/img/avatars/swan.png differ diff --git a/app/www/img/avatars/tiger.png b/app/www/img/avatars/tiger.png new file mode 100644 index 0000000..b85ee3d Binary files /dev/null and b/app/www/img/avatars/tiger.png differ diff --git a/app/www/img/avatars/toucan.png b/app/www/img/avatars/toucan.png new file mode 100644 index 0000000..d16afd8 Binary files /dev/null and b/app/www/img/avatars/toucan.png differ diff --git a/app/www/img/avatars/turtle.png b/app/www/img/avatars/turtle.png new file mode 100644 index 0000000..b589cba Binary files /dev/null and b/app/www/img/avatars/turtle.png differ diff --git a/app/www/img/avatars/whale.png b/app/www/img/avatars/whale.png new file mode 100644 index 0000000..db39b49 Binary files /dev/null and b/app/www/img/avatars/whale.png differ diff --git a/app/www/img/users.png b/app/www/img/users.png new file mode 100644 index 0000000..c46ac06 Binary files /dev/null and b/app/www/img/users.png differ diff --git a/app/www/js/app.js b/app/www/js/app.js index a197ebe..728be93 100644 --- a/app/www/js/app.js +++ b/app/www/js/app.js @@ -41,14 +41,24 @@ angular.module('starter', ['ionic', 'starter.controllers']) } }) - .state('app.browse', { - url: '/browse', + .state('app.users', { + url: '/users', views: { 'menuContent': { - templateUrl: 'templates/browse.html' + templateUrl: 'templates/users.html', + controller: 'UsersCtrl' } } }) + .state('app.user', { + url: '/users/:username', + views: { + 'menuContent': { + templateUrl: 'templates/user.html', + controller: 'UserCtrl' + } + } + }) .state('app.travels', { url: '/travels', views: { diff --git a/app/www/js/controllers.js b/app/www/js/controllers.js index c90aea1..88c60b7 100644 --- a/app/www/js/controllers.js +++ b/app/www/js/controllers.js @@ -45,6 +45,7 @@ angular.module('starter.controllers', []) .controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout) { $scope.travels=""; + $scope.travels=JSON.parse(localStorage.getItem('c_travels')); $scope.doRefresh = function() { $http.get('http://localhost:3000/api/travels') @@ -52,6 +53,7 @@ angular.module('starter.controllers', []) console.log('data success'); console.log(data); // for browser console $scope.travels = data; // for UI + localStorage.setItem('c_travels', JSON.stringify($scope.travels)); $scope.$broadcast('scroll.refreshComplete');//refresher stop }) .error(function(data, status, headers,config){ @@ -117,6 +119,7 @@ angular.module('starter.controllers', []) console.log(response); $scope.newtravel._id=response.data._id; $scope.travels.push($scope.newtravel); + $scope.newtravel={}; }, function(response) { // optional // failed @@ -176,4 +179,45 @@ angular.module('starter.controllers', []) .then(function(result){ travels = result.data; }); +}) + +.controller('UsersCtrl', function($scope, $http, $ionicModal, $timeout) { + $scope.users=""; + + $scope.users=JSON.parse(localStorage.getItem('c_users')); + + $scope.doRefresh = function() { + $http.get('http://localhost:3000/api/users') + .success(function(data, status, headers, config){ + console.log('data success'); + console.log(data); // for browser console + $scope.users = data; // for UI + localStorage.setItem('c_users', JSON.stringify($scope.users)); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + }) + .error(function(data, status, headers,config){ + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete');//refresher stop + }) + .then(function(result){ + users = result.data; + }); + }; +}) + +.controller('UserCtrl', function($scope, $stateParams, $http) { + $scope.travel=""; + console.log($stateParams.username); + $http.get('http://localhost:3000/api/users/byusername/'+$stateParams.username) + .success(function(data, status, headers,config){ + console.log('data success'); + console.log(data); // for browser console + $scope.user = data; // for UI + }) + .error(function(data, status, headers,config){ + console.log('data error'); + }) + .then(function(result){ + travels = result.data; + }); }); diff --git a/app/www/templates/menu.html b/app/www/templates/menu.html index 1d1ef50..04631b7 100644 --- a/app/www/templates/menu.html +++ b/app/www/templates/menu.html @@ -29,18 +29,14 @@ Travels - - - Transport material + + + Users Available cars - - - Users - diff --git a/app/www/templates/travel.html b/app/www/templates/travel.html index 6e6bcda..77fabd0 100644 --- a/app/www/templates/travel.html +++ b/app/www/templates/travel.html @@ -2,13 +2,16 @@
- Collectivized +

{{travel.title}}

-

{{travel.owner}}

+
{{travel.date | date:"dd/MM HH:mm a"}}
-
{{travel.date | date:"dd/MM HH:mm a"}}
+ Collectivized +
can carry package
diff --git a/app/www/templates/travels.html b/app/www/templates/travels.html index eb22e31..91219c7 100644 --- a/app/www/templates/travels.html +++ b/app/www/templates/travels.html @@ -19,8 +19,10 @@

nºseats: {{travel.seats}}

nºpeople: {{travel.seats}}

-
{{travel.owner}}
-
{{travel.date | date:"dd/MM HH:mm a"}}
+
+
{{travel.date | date:"dd/MM HH:mm a"}}
+
{{travel.owner}}
+
diff --git a/app/www/templates/user.html b/app/www/templates/user.html new file mode 100644 index 0000000..3f3c8dd --- /dev/null +++ b/app/www/templates/user.html @@ -0,0 +1,18 @@ + + +
+ + +

{{user.username}}

+
+
+

{{user.description}}

+

{{user.mail}}

+

+ {{user.telegram}} +

+
+
+
diff --git a/app/www/templates/users.html b/app/www/templates/users.html new file mode 100644 index 0000000..7b43891 --- /dev/null +++ b/app/www/templates/users.html @@ -0,0 +1,23 @@ + + + + + + + diff --git a/server/controllers/travelController.js b/server/controllers/travelController.js index eeab174..62c6174 100644 --- a/server/controllers/travelController.js +++ b/server/controllers/travelController.js @@ -28,7 +28,7 @@ exports.findById = function(req, res) { exports.findAllTravelsFromUsername = function(req, res) { travelModel.find({ - authorname: req.params.userid + _id: req.params.userid }, function(err, travels) { if (err) throw err; diff --git a/server/controllers/userController.js b/server/controllers/userController.js index da36ca5..e9ef907 100644 --- a/server/controllers/userController.js +++ b/server/controllers/userController.js @@ -42,7 +42,8 @@ exports.findUserByUsername = function(req, res) { } else if (user) { console.log(user); // return the information including token as JSON - res.jsonp(user); + //res.jsonp(user); + res.status(200).jsonp(user[0]); } @@ -61,7 +62,8 @@ exports.addUser = function(req, res) { description: req.body.description, avatar: req.body.avatar, mail: req.body.mail, - admin: req.body.admin + phone: req.body.phone, + telegram: req.body.telegram }); user.save(function(err, user) { @@ -78,7 +80,8 @@ exports.updateUser = function(req, res) { user.description = req.body.description; user.avatar = req.body.avatar; user.mail = req.body.mail; - user.admin = req.body.admin; + user.phone = req.body.phone; + user.telegram = req.body.telegram; user.save(function(err) { if(err) return res.send(500, err.message); diff --git a/server/models/userModel.js b/server/models/userModel.js index 3fbd11e..1f9e36d 100644 --- a/server/models/userModel.js +++ b/server/models/userModel.js @@ -8,6 +8,7 @@ var userSchema = new Schema({ description: { type: String }, avatar: { type: String }, mail: { type: String }, - phone: { type: String } + phone: { type: String }, + telegram: { type: String } }) module.exports = mongoose.model('userModel', userSchema);