Browse Source

user page and users page added

pull/1/head
nau 8 years ago
parent
commit
959c9692d3
62 changed files with 120 additions and 20 deletions
  1. BIN
      app/www/img/asking.png
  2. BIN
      app/www/img/avatars/anteater.png
  3. BIN
      app/www/img/avatars/bat.png
  4. BIN
      app/www/img/avatars/beetle.png
  5. BIN
      app/www/img/avatars/bulldog.png
  6. BIN
      app/www/img/avatars/butterfly.png
  7. BIN
      app/www/img/avatars/camel.png
  8. BIN
      app/www/img/avatars/cat.png
  9. BIN
      app/www/img/avatars/chameleon.png
  10. BIN
      app/www/img/avatars/clown-fish.png
  11. BIN
      app/www/img/avatars/cobra.png
  12. BIN
      app/www/img/avatars/cow.png
  13. BIN
      app/www/img/avatars/crab.png
  14. BIN
      app/www/img/avatars/crocodile.png
  15. BIN
      app/www/img/avatars/duck.png
  16. BIN
      app/www/img/avatars/elephant.png
  17. BIN
      app/www/img/avatars/frog.png
  18. BIN
      app/www/img/avatars/giraffe.png
  19. BIN
      app/www/img/avatars/hen.png
  20. BIN
      app/www/img/avatars/hippopotamus.png
  21. BIN
      app/www/img/avatars/kangaroo.png
  22. BIN
      app/www/img/avatars/lion.png
  23. BIN
      app/www/img/avatars/llama.png
  24. BIN
      app/www/img/avatars/macaw.png
  25. BIN
      app/www/img/avatars/monkey.png
  26. BIN
      app/www/img/avatars/moose.png
  27. BIN
      app/www/img/avatars/mouse.png
  28. BIN
      app/www/img/avatars/octopus.png
  29. BIN
      app/www/img/avatars/ostrich.png
  30. BIN
      app/www/img/avatars/owl.png
  31. BIN
      app/www/img/avatars/panda.png
  32. BIN
      app/www/img/avatars/pelican.png
  33. BIN
      app/www/img/avatars/penguin.png
  34. BIN
      app/www/img/avatars/pig.png
  35. BIN
      app/www/img/avatars/rabbit.png
  36. BIN
      app/www/img/avatars/racoon.png
  37. BIN
      app/www/img/avatars/ray.png
  38. BIN
      app/www/img/avatars/rhinoceros.png
  39. BIN
      app/www/img/avatars/sea-cow.png
  40. BIN
      app/www/img/avatars/shark.png
  41. BIN
      app/www/img/avatars/sheep.png
  42. BIN
      app/www/img/avatars/siberian-husky.png
  43. BIN
      app/www/img/avatars/sloth.png
  44. BIN
      app/www/img/avatars/snake.png
  45. BIN
      app/www/img/avatars/spider.png
  46. BIN
      app/www/img/avatars/squirrel.png
  47. BIN
      app/www/img/avatars/swan.png
  48. BIN
      app/www/img/avatars/tiger.png
  49. BIN
      app/www/img/avatars/toucan.png
  50. BIN
      app/www/img/avatars/turtle.png
  51. BIN
      app/www/img/avatars/whale.png
  52. BIN
      app/www/img/users.png
  53. +13
    -3
      app/www/js/app.js
  54. +44
    -0
      app/www/js/controllers.js
  55. +3
    -7
      app/www/templates/menu.html
  56. +6
    -3
      app/www/templates/travel.html
  57. +4
    -2
      app/www/templates/travels.html
  58. +18
    -0
      app/www/templates/user.html
  59. +23
    -0
      app/www/templates/users.html
  60. +1
    -1
      server/controllers/travelController.js
  61. +6
    -3
      server/controllers/userController.js
  62. +2
    -1
      server/models/userModel.js

BIN
app/www/img/asking.png

Before After
Width: 512  |  Height: 512  |  Size: 8.3 KiB Width: 512  |  Height: 512  |  Size: 15 KiB

BIN
app/www/img/avatars/anteater.png

Before After
Width: 512  |  Height: 512  |  Size: 8.1 KiB

BIN
app/www/img/avatars/bat.png

Before After
Width: 512  |  Height: 512  |  Size: 10 KiB

BIN
app/www/img/avatars/beetle.png

Before After
Width: 512  |  Height: 512  |  Size: 16 KiB

BIN
app/www/img/avatars/bulldog.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/butterfly.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/camel.png

Before After
Width: 512  |  Height: 512  |  Size: 13 KiB

BIN
app/www/img/avatars/cat.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/chameleon.png

Before After
Width: 512  |  Height: 512  |  Size: 15 KiB

BIN
app/www/img/avatars/clown-fish.png

Before After
Width: 512  |  Height: 512  |  Size: 21 KiB

BIN
app/www/img/avatars/cobra.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/cow.png

Before After
Width: 512  |  Height: 512  |  Size: 21 KiB

BIN
app/www/img/avatars/crab.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/crocodile.png

Before After
Width: 512  |  Height: 512  |  Size: 8.7 KiB

BIN
app/www/img/avatars/duck.png

Before After
Width: 512  |  Height: 512  |  Size: 9.6 KiB

BIN
app/www/img/avatars/elephant.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/frog.png

Before After
Width: 512  |  Height: 512  |  Size: 15 KiB

BIN
app/www/img/avatars/giraffe.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/hen.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/hippopotamus.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/kangaroo.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/lion.png

Before After
Width: 512  |  Height: 512  |  Size: 17 KiB

BIN
app/www/img/avatars/llama.png

Before After
Width: 512  |  Height: 512  |  Size: 8.4 KiB

BIN
app/www/img/avatars/macaw.png

Before After
Width: 512  |  Height: 512  |  Size: 14 KiB

BIN
app/www/img/avatars/monkey.png

Before After
Width: 512  |  Height: 512  |  Size: 16 KiB

BIN
app/www/img/avatars/moose.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/mouse.png

Before After
Width: 512  |  Height: 512  |  Size: 10 KiB

BIN
app/www/img/avatars/octopus.png

Before After
Width: 512  |  Height: 512  |  Size: 21 KiB

BIN
app/www/img/avatars/ostrich.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/owl.png

Before After
Width: 512  |  Height: 512  |  Size: 15 KiB

BIN
app/www/img/avatars/panda.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/pelican.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/penguin.png

Before After
Width: 512  |  Height: 512  |  Size: 14 KiB

BIN
app/www/img/avatars/pig.png

Before After
Width: 512  |  Height: 512  |  Size: 13 KiB

BIN
app/www/img/avatars/rabbit.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/racoon.png

Before After
Width: 512  |  Height: 512  |  Size: 13 KiB

BIN
app/www/img/avatars/ray.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/rhinoceros.png

Before After
Width: 512  |  Height: 512  |  Size: 10 KiB

BIN
app/www/img/avatars/sea-cow.png

Before After
Width: 512  |  Height: 512  |  Size: 7.5 KiB

BIN
app/www/img/avatars/shark.png

Before After
Width: 512  |  Height: 512  |  Size: 9.5 KiB

BIN
app/www/img/avatars/sheep.png

Before After
Width: 512  |  Height: 512  |  Size: 10 KiB

BIN
app/www/img/avatars/siberian-husky.png

Before After
Width: 512  |  Height: 512  |  Size: 19 KiB

BIN
app/www/img/avatars/sloth.png

Before After
Width: 512  |  Height: 512  |  Size: 15 KiB

BIN
app/www/img/avatars/snake.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/spider.png

Before After
Width: 512  |  Height: 512  |  Size: 20 KiB

BIN
app/www/img/avatars/squirrel.png

Before After
Width: 512  |  Height: 512  |  Size: 14 KiB

BIN
app/www/img/avatars/swan.png

Before After
Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
app/www/img/avatars/tiger.png

Before After
Width: 512  |  Height: 512  |  Size: 22 KiB

BIN
app/www/img/avatars/toucan.png

Before After
Width: 512  |  Height: 512  |  Size: 11 KiB

BIN
app/www/img/avatars/turtle.png

Before After
Width: 512  |  Height: 512  |  Size: 20 KiB

BIN
app/www/img/avatars/whale.png

Before After
Width: 512  |  Height: 512  |  Size: 9.2 KiB

BIN
app/www/img/users.png

Before After
Width: 32  |  Height: 32  |  Size: 922 B

+ 13
- 3
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: {

+ 44
- 0
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;
});
});

+ 3
- 7
app/www/templates/menu.html

@ -29,18 +29,14 @@
<img class='o-imgMenu' src="img/road.png" />
Travels
</ion-item>
<ion-item menu-close href="#/app/browse">
<img class='o-imgMenu' src="img/package.png" />
Transport material
<ion-item menu-close href="#/app/users">
<img class='o-imgMenu' src="img/users.png" />
Users
</ion-item>
<ion-item menu-close href="#/app/search">
<img class='o-imgMenu' src="img/carimg/station-wagon.png" />
Available cars
</ion-item>
<ion-item menu-close href="#/app/browse">
<img class='o-imgMenu' src="img/community.png" />
Users
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>

+ 6
- 3
app/www/templates/travel.html

@ -2,13 +2,16 @@
<ion-content>
<div class="item item-avatar">
<img ng-src="img/{{travel.modality}}.png" />
<span class="badge badge-balanced" ng-show="travel.collectivized">Collectivized</span>
<div class="item-note o-text-right">
<a class="badge badge-calm" href="#/app/users/{{travel.owner}}">{{travel.owner}}</a>
</div>
<h2>{{travel.title}}</h2>
<p>{{travel.owner}}</p>
<div class="">{{travel.date | date:"dd/MM HH:mm a"}}</div>
</div>
<div class="item item-body">
<div class='o-float-right o-text-right'>
<div class="">{{travel.date | date:"dd/MM HH:mm a"}}</div>
<span class="badge badge-balanced" ng-show="travel.collectivized">Collectivized</span>
<br>
<div class="o-mini-text" ng-show="travel.package">
<div ng-show="travel.modality=='offering'">can carry package <img src="img/package.png" class="o-imgMenu" /></div>

+ 4
- 2
app/www/templates/travels.html

@ -19,8 +19,10 @@
</p>
<p class="" ng-show="travel.modality=='offering'">nºseats: {{travel.seats}}</p>
<p class="" ng-show="travel.modality=='asking'">nºpeople: {{travel.seats}}</p>
<div class="badge badge-calm item-note">{{travel.owner}}</div>
<div class="badge badge-calm item-note">{{travel.date | date:"dd/MM HH:mm a"}}</div>
<div class="item-note">
<div class="positive">{{travel.date | date:"dd/MM HH:mm a"}}</div>
<div class="badge badge-calm">{{travel.owner}}</div>
</div>
</a>
</div>
</ion-content>

+ 18
- 0
app/www/templates/user.html

@ -0,0 +1,18 @@
<ion-view view-title="User">
<ion-content>
<div class="item item-avatar">
<img ng-src="img/avatars/{{user.avatar}}.png" />
<div class="item-note o-text-right">
<a class="badge badge-calm" href="#/app/users/{{travel.owner}}">{{user.owner}}</a>
</div>
<h2>{{user.username}}</h2>
</div>
<div class="item item-body">
<p class="o-bold">{{user.description}}</p>
<p>{{user.mail}}</p>
<p>
<img class='o-imgMenu' src="img/telegram.png" /> {{user.telegram}}
</p>
</div>
</ion-content>
</ion-view>

+ 23
- 0
app/www/templates/users.html

@ -0,0 +1,23 @@
<ion-view view-title="Users">
<ion-content>
<ion-refresher
pulling-text="Pull to refresh..."
on-refresh="doRefresh()">
</ion-refresher>
<div class="list">
<div class="o-float-right">
<a ng-click="showNewAskingTravel()" class="button icon ion-email"></a>
<a ng-click="showNewAskingTravel()" class="button icon ion-help"></a>
<a ng-click="showNewOfferingTravel()" class="button icon ion-plus"></a>
</div>
<a ng-repeat="user in users | orderBy: 'date'" class="item item-avatar" href="#/app/users/{{user.username}}">
<img ng-src="img/avatars/{{user.avatar}}.png">
<h2>{{user.username}}</h2>
<p>
{{user.description}}
</p>
</a>
</div>
</ion-content>
</ion-view>

+ 1
- 1
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;

+ 6
- 3
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);

+ 2
- 1
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);

Loading…
Cancel
Save