diff --git a/www/img/asking.png b/www/img/asking.png deleted file mode 100644 index 4a03480..0000000 Binary files a/www/img/asking.png and /dev/null differ diff --git a/www/img/avatars/chameleon.png b/www/img/avatars/chameleon.png new file mode 100644 index 0000000..91f30f6 Binary files /dev/null and b/www/img/avatars/chameleon.png differ diff --git a/www/img/avatars/clown-fish.png b/www/img/avatars/clown-fish.png new file mode 100644 index 0000000..2473fcc Binary files /dev/null and b/www/img/avatars/clown-fish.png differ diff --git a/www/img/avatars/duck.png b/www/img/avatars/duck.png new file mode 100644 index 0000000..2c48212 Binary files /dev/null and b/www/img/avatars/duck.png differ diff --git a/www/img/avatars/owl.png b/www/img/avatars/owl.png new file mode 100644 index 0000000..732dc88 Binary files /dev/null and b/www/img/avatars/owl.png differ diff --git a/www/img/avatars/penguin.png b/www/img/avatars/penguin.png new file mode 100644 index 0000000..295e7f1 Binary files /dev/null and b/www/img/avatars/penguin.png differ diff --git a/www/img/avatars/siberian-husky.png b/www/img/avatars/siberian-husky.png new file mode 100644 index 0000000..9de786f Binary files /dev/null and b/www/img/avatars/siberian-husky.png differ diff --git a/www/img/avatars/sloth.png b/www/img/avatars/sloth.png new file mode 100644 index 0000000..2f7322a Binary files /dev/null and b/www/img/avatars/sloth.png differ diff --git a/www/img/avatars/tiger.png b/www/img/avatars/tiger.png new file mode 100644 index 0000000..b85ee3d Binary files /dev/null and b/www/img/avatars/tiger.png differ diff --git a/www/img/avatars/toucan.png b/www/img/avatars/toucan.png new file mode 100644 index 0000000..d16afd8 Binary files /dev/null and b/www/img/avatars/toucan.png differ diff --git a/www/img/collectivized.png b/www/img/collectivized.png deleted file mode 100644 index a081555..0000000 Binary files a/www/img/collectivized.png and /dev/null differ diff --git a/www/img/comment.png b/www/img/comment.png deleted file mode 100644 index 1483eb8..0000000 Binary files a/www/img/comment.png and /dev/null differ diff --git a/www/img/community.png b/www/img/community.png deleted file mode 100644 index 44d6eba..0000000 Binary files a/www/img/community.png and /dev/null differ diff --git a/www/img/fav.png b/www/img/fav.png deleted file mode 100644 index 8b30fda..0000000 Binary files a/www/img/fav.png and /dev/null differ diff --git a/www/img/foucault.jpg b/www/img/foucault.jpg deleted file mode 100644 index 8675490..0000000 Binary files a/www/img/foucault.jpg and /dev/null differ diff --git a/www/img/from-to.png b/www/img/from-to.png deleted file mode 100644 index 92b2cac..0000000 Binary files a/www/img/from-to.png and /dev/null differ diff --git a/www/img/header.png b/www/img/header.png deleted file mode 100644 index b52e9a0..0000000 Binary files a/www/img/header.png and /dev/null differ diff --git a/www/img/header_background.png b/www/img/header_background.png deleted file mode 100644 index 2491785..0000000 Binary files a/www/img/header_background.png and /dev/null differ diff --git a/www/img/help.png b/www/img/help.png deleted file mode 100644 index 84ce649..0000000 Binary files a/www/img/help.png and /dev/null differ diff --git a/www/img/ionic.png b/www/img/ionic.png deleted file mode 100644 index 21c7f37..0000000 Binary files a/www/img/ionic.png and /dev/null differ diff --git a/www/img/join.png b/www/img/join.png deleted file mode 100644 index 5695066..0000000 Binary files a/www/img/join.png and /dev/null differ diff --git a/www/img/localization.png b/www/img/localization.png deleted file mode 100644 index 3eaa343..0000000 Binary files a/www/img/localization.png and /dev/null differ diff --git a/www/img/newasking.png b/www/img/newasking.png deleted file mode 100644 index 0633363..0000000 Binary files a/www/img/newasking.png and /dev/null differ diff --git a/www/img/newoffering.png b/www/img/newoffering.png deleted file mode 100644 index ec33d86..0000000 Binary files a/www/img/newoffering.png and /dev/null differ diff --git a/www/img/newpackage.png b/www/img/newpackage.png deleted file mode 100644 index e7f7fb6..0000000 Binary files a/www/img/newpackage.png and /dev/null differ diff --git a/www/img/notification.png b/www/img/notification.png deleted file mode 100644 index 63d5c6e..0000000 Binary files a/www/img/notification.png and /dev/null differ diff --git a/www/img/offering.png b/www/img/offering.png deleted file mode 100644 index d08b2e2..0000000 Binary files a/www/img/offering.png and /dev/null differ diff --git a/www/img/package.png b/www/img/package.png deleted file mode 100644 index cfdf84b..0000000 Binary files a/www/img/package.png and /dev/null differ diff --git a/www/img/road.png b/www/img/road.png deleted file mode 100644 index 70ddd48..0000000 Binary files a/www/img/road.png and /dev/null differ diff --git a/www/img/rss-symbol.png b/www/img/rss-symbol.png deleted file mode 100644 index 46d2ed6..0000000 Binary files a/www/img/rss-symbol.png and /dev/null differ diff --git a/www/img/settings.png b/www/img/settings.png deleted file mode 100644 index fcb0750..0000000 Binary files a/www/img/settings.png and /dev/null differ diff --git a/www/img/smartphone.png b/www/img/smartphone.png deleted file mode 100644 index 35bacf1..0000000 Binary files a/www/img/smartphone.png and /dev/null differ diff --git a/www/img/telegram.png b/www/img/telegram.png deleted file mode 100644 index 3de14d0..0000000 Binary files a/www/img/telegram.png and /dev/null differ diff --git a/www/img/unlike.png b/www/img/unlike.png deleted file mode 100644 index eae8921..0000000 Binary files a/www/img/unlike.png and /dev/null differ diff --git a/www/img/users.png b/www/img/users.png deleted file mode 100644 index c46ac06..0000000 Binary files a/www/img/users.png and /dev/null differ diff --git a/www/js/travel.js b/www/js/travel.js index cc567c2..32a2d19 100644 --- a/www/js/travel.js +++ b/www/js/travel.js @@ -1,246 +1,287 @@ angular.module('app.travel', ['pascalprecht.translate', 'ui-leaflet']) -.controller('TravelCtrl', function($scope, $stateParams, $http, - $ionicModal, $ionicLoading, $ionicPopup, $filter, - leafletData, leafletBoundsHelpers) { + .controller('TravelCtrl', function($scope, $stateParams, $http, + $ionicModal, $ionicLoading, $ionicPopup, $filter, + leafletData, leafletBoundsHelpers) { $scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata")); - $scope.center= { - /*lat: 0, - lng: 0, - zoom: 1*/ + $scope.center = { + /*lat: 0, + lng: 0, + zoom: 1*/ }; - $scope.bounds={}; - $scope.markers=[]; - $scope.tiles= { - url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", - options: { - attribution: 'OpenStreetMap contributors' - } + $scope.bounds = {}; + $scope.markers = []; + $scope.tiles = { + url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + options: { + attribution: 'OpenStreetMap contributors' + } }; - $scope.travel={}; + $scope.travel = {}; $scope.doRefresh = function() { /* travels refresh: */ - $http.get(urlapi + 'travels/id/' + $stateParams.travelid) - .then(function(data){ - console.log('data success travels'); - console.log(data); // for browser console - $scope.travel = data.data; // for UI - $scope.markers=[]; - $scope.markers.push({ - lat: Number($scope.travel.from.lat), - lng: Number($scope.travel.from.long), - message: $scope.travel.from.name - }); - $scope.markers.push({ - lat: Number($scope.travel.to.lat), - lng: Number($scope.travel.to.long), - message: $scope.travel.to.name - }); - $scope.center= { - lat: (Number($scope.travel.from.lat)+Number($scope.travel.to.lat))/2, - lng: (Number($scope.travel.from.long)+Number($scope.travel.to.long))/2, - zoom: 4 - }; - - $scope.$broadcast('scroll.refreshComplete');//refresher stop - - }, function(data){ - console.log('data error'); - $scope.$broadcast('scroll.refreshComplete');//refresher stop - $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + $http.get(urlapi + 'travels/id/' + $stateParams.travelid) + .then(function(data) { + console.log('data success travels'); + console.log(data); // for browser console + $scope.travel = data.data; // for UI + $scope.markers = []; + $scope.markers.push({ + lat: Number($scope.travel.from.lat), + lng: Number($scope.travel.from.long), + message: $scope.travel.from.name + }); + $scope.markers.push({ + lat: Number($scope.travel.to.lat), + lng: Number($scope.travel.to.long), + message: $scope.travel.to.name + }); + $scope.center = { + lat: (Number($scope.travel.from.lat) + Number($scope.travel.to.lat)) / 2, + lng: (Number($scope.travel.from.long) + Number($scope.travel.to.long)) / 2, + zoom: 4 + }; + + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + + }, function(data) { + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + $ionicLoading.show({ + template: 'Error connecting server', + noBackdrop: true, + duration: 2000 + }); }); }; $scope.doRefresh(); - $scope.deleteTravel = function(){ - - var confirmPopup = $ionicPopup.confirm({ - title: 'Deleting publication', - template: 'Are you sure you want to delete '+ $scope.travel.title+'?' - }); - confirmPopup.then(function(res) { - if(res) { - console.log('You are sure'); - console.log("delete travel: " + $stateParams.travelid); - $http({ - url: urlapi + '/travels/id/modify/' + $stateParams.travelid, - method: "DELETE" - }) - .then(function(response) { - console.log(response); - $scope.travels=response.data; - localStorage.setItem('c_travels', JSON.stringify($scope.travels)); - localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date())); - - }, - function(response) { // optional - // failed - }); - } else { - console.log('You are not sure'); - } - }); + $scope.deleteTravel = function() { + + var confirmPopup = $ionicPopup.confirm({ + title: 'Deleting publication', + template: 'Are you sure you want to delete ' + $scope.travel.title + '?' + }); + confirmPopup.then(function(res) { + if (res) { + console.log('You are sure'); + console.log("delete travel: " + $stateParams.travelid); + $http({ + url: urlapi + '/travels/id/modify/' + $stateParams.travelid, + method: "DELETE" + }) + .then(function(response) { + console.log(response); + $scope.travels = response.data; + localStorage.setItem('c_travels', JSON.stringify($scope.travels)); + localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date())); + + }, + function(response) { // optional + // failed + }); + } else { + console.log('You are not sure'); + } + }); }; - $scope.joinTravel = function(){ - $http({ - url: urlapi + 'travels/join/'+ $stateParams.travelid, - method: "POST", - data: {} + $scope.joinTravel = function() { + $http({ + url: urlapi + 'travels/join/' + $stateParams.travelid, + method: "POST", + data: {} }) .then(function(data) { console.log("data: "); console.log(data); - if(data.data.success==false){ - $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000}); - }else{ - $scope.travel=data.data; + if (data.data.success == false) { + $ionicLoading.show({ + template: 'Error on unjoin', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.travel = data.data; } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.unjoinTravel = function(){ - $http({ - url: urlapi + 'travels/unjoin/'+ $stateParams.travelid, - method: "POST", - data: {} + $scope.unjoinTravel = function() { + $http({ + url: urlapi + 'travels/unjoin/' + $stateParams.travelid, + method: "POST", + data: {} }) .then(function(data) { console.log("data: "); console.log(data); - if(data.data.success==false){ - $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000}); - }else{ - $scope.travel=data.data; + if (data.data.success == false) { + $ionicLoading.show({ + template: 'Error on unjoin', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.travel = data.data; } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.declineJoin = function(joinPetition){ - $http({ - url: urlapi + 'travels/declineJoin/'+ $stateParams.travelid, - method: "POST", - data: {userid: joinPetition._id} + $scope.declineJoin = function(joinPetition) { + $http({ + url: urlapi + 'travels/declineJoin/' + $stateParams.travelid, + method: "POST", + data: { + userid: joinPetition._id + } }) .then(function(data) { console.log("data: "); console.log(data); - if(data.data.success==false){ - $ionicLoading.show({template: 'Error on declining', noBackdrop: true, duration: 2000}); - }else{ - $scope.travel=data.data; - console.log("success"); + if (data.data.success == false) { + $ionicLoading.show({ + template: 'Error on declining', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.travel = data.data; + console.log("success"); } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.acceptJoin = function(joinPetition){ - $http({ - url: urlapi + 'travels/acceptJoin/'+ $stateParams.travelid, - method: "POST", - data: {userid: joinPetition._id} + $scope.acceptJoin = function(joinPetition) { + $http({ + url: urlapi + 'travels/acceptJoin/' + $stateParams.travelid, + method: "POST", + data: { + userid: joinPetition._id + } }) .then(function(data) { console.log("data: "); console.log(data); - if(data.data.success==false){ - $ionicLoading.show({template: 'Error on accepting', noBackdrop: true, duration: 2000}); - }else{ - $scope.travel=data.data; - console.log("success"); + if (data.data.success == false) { + $ionicLoading.show({ + template: 'Error on accepting', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.travel = data.data; + console.log("success"); } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.leaveTravel = function(){ - $http({ - url: urlapi + 'travels/leave/'+ $stateParams.travelid, - method: "POST", - data: {} - }) - .then(function(data) { - console.log("data: "); - console.log(data); - if(data.data.success==false){ - $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000}); - }else{ - $scope.travel=data.data; - } - }, - function(response) { // optional + $scope.leaveTravel = function() { + var confirmPopup = $ionicPopup.confirm({ + title: 'Leaving travel', + template: 'Are you sure you want to leave ' + $scope.travel.title + '?' + }); + confirmPopup.then(function(res) { + if (res) { + $http({ + url: urlapi + 'travels/leave/' + $stateParams.travelid, + method: "POST", + data: {} + }) + .then(function(data) { + console.log("data: "); + console.log(data); + if (data.data.success == false) { + $ionicLoading.show({ + template: 'Error on unjoin', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.travel = data.data; + } + }, + function(response) { // optional // failed - }); + }); + } else { + console.log('You are not sure'); + } + }); }; /* adding comment */ - $scope.doingNewComment=false; - $scope.newComment={}; + $scope.doingNewComment = false; + $scope.newComment = {}; $scope.showNewComment = function() { - $scope.doingNewComment=true; + $scope.doingNewComment = true; }; $scope.closeNewComment = function() { - $scope.doingNewComment=false; + $scope.doingNewComment = false; }; $scope.doNewComment = function() { - /*$scope.newComment.commentUserId=localStorage.getItem("c_userid"); - $scope.newComment.commentUsername=localStorage.getItem("c_username"); - $scope.newComment.commentAvatar=localStorage.getItem("c_avatar");*/ -console.log($scope.newComment); - $http({ - url: urlapi + 'travels/'+ $stateParams.travelId+'/comment', + /*$scope.newComment.commentUserId=localStorage.getItem("c_userid"); + $scope.newComment.commentUsername=localStorage.getItem("c_username"); + $scope.newComment.commentAvatar=localStorage.getItem("c_avatar");*/ + console.log($scope.newComment); + $http({ + url: urlapi + 'travels/' + $stateParams.travelId + '/comment', method: "POST", data: $scope.newComment }) .then(function(response) { - // success - console.log("newComment added to server: " + response); - console.log(response); - $scope.travels=response.data; - localStorage.setItem('c_travels', JSON.stringify($scope.travels)); - localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date())); - $scope.travel = $filter('filter')($scope.travels, $stateParams.travelId, true)[0]; - - if(response.data.success==false){ - - $ionicLoading.show({ template: 'failed to generate new asking package', noBackdrop: true, duration: 2000 }); - } - }, - function(response) { // optional - // failed - }); - $scope.closeNewComment(); + // success + console.log("newComment added to server: " + response); + console.log(response); + $scope.travels = response.data; + localStorage.setItem('c_travels', JSON.stringify($scope.travels)); + localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date())); + $scope.travel = $filter('filter')($scope.travels, $stateParams.travelId, true)[0]; + + if (response.data.success == false) { + + $ionicLoading.show({ + template: 'failed to generate new asking package', + noBackdrop: true, + duration: 2000 + }); + } + }, + function(response) { // optional + // failed + }); + $scope.closeNewComment(); }; $scope.userHasJoined = function(myArray, searchTerm) { //console.log(myArray+", "+searchTerm); - if(myArray) - { - for(var i = 0, len = myArray.length; i < len; i++) { - //console.log(myArray[i] + " - " + searchTerm); - if (myArray[i]._id === searchTerm){ - //console.log("i: " + i); - return i; - } - } + if (myArray) { + for (var i = 0, len = myArray.length; i < len; i++) { + //console.log(myArray[i] + " - " + searchTerm); + if (myArray[i]._id === searchTerm) { + //console.log("i: " + i); + return i; + } } - //console.log("i: -1"); - return -1; + } + //console.log("i: -1"); + return -1; }; -}); + }); diff --git a/www/js/travels.js b/www/js/travels.js index 896b5dd..d624ab9 100644 --- a/www/js/travels.js +++ b/www/js/travels.js @@ -1,32 +1,46 @@ angular.module('app.travels', ['pascalprecht.translate']) -.controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + .controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) { + $scope.loadMorePagination = true; - - $scope.travels=[]; - $scope.page=0; + $scope.travels = []; + $scope.page = 0; $scope.doRefresh = function() { /* travels refresh: */ - $http.get(urlapi + 'travels?page=' + $scope.page) - .then(function(data){ - console.log('data success travels'); - console.log(data); // for browser console - //$scope.travels = data.data; // for UI - $scope.travels=$scope.travels.concat(data.data); - $scope.$broadcast('scroll.refreshComplete');//refresher stop + $http.get(urlapi + 'travels?page=' + $scope.page) + .then(function(data) { + console.log('data success travels'); + console.log(data); // for browser console + //$scope.travels = data.data; // for UI + $scope.travels = $scope.travels.concat(data.data); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + $scope.$broadcast('scroll.infiniteScrollComplete'); + if (data.data.length < 1) { + console.log("setting loadMorePagination to false"); + $scope.loadMorePagination = false; + } - }, function(data){ - console.log('data error'); - $scope.$broadcast('scroll.refreshComplete');//refresher stop - $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 }); + }, function(data) { + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + $ionicLoading.show({ + template: 'Error connecting server', + noBackdrop: true, + duration: 2000 + }); }); }; $scope.doRefresh(); - $scope.paginationNext = function(){ + $scope.paginationNext = function() { + if ($scope.loadMorePagination == true) { $scope.page++; console.log($scope.page); $scope.doRefresh(); + }else{ + console.log("limit pagination reached"); + $scope.$broadcast('scroll.infiniteScrollComplete'); + } }; -}); + }); diff --git a/www/js/user.js b/www/js/user.js index 86242f1..083033d 100644 --- a/www/js/user.js +++ b/www/js/user.js @@ -1,124 +1,135 @@ angular.module('app.user', ['pascalprecht.translate']) -.controller('UserCtrl', function($scope, $stateParams, $http, - $ionicLoading, $filter, $ionicModal) { + .controller('UserCtrl', function($scope, $stateParams, $http, + $ionicLoading, $filter, $ionicModal) { $scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata")); - $scope.user={}; - $scope.doRefresh = function(){ - $http.get(urlapi + 'users/id/'+$stateParams.userid) - .then(function(data, status, headers,config){ - console.log('data success'); - console.log(data); // for browser console - $scope.user = data.data; // for UI - if($scope.storageuser._id==$scope.user._id) - { - localStorage.setItem("cim_app_userdata", JSON.stringify(data.data)); - } - $scope.$broadcast('scroll.refreshComplete');//refresher stop - },function(data, status, headers,config){ - console.log('data error'); - $scope.$broadcast('scroll.refreshComplete');//refresher stop + $scope.user = {}; + $scope.doRefresh = function() { + $http.get(urlapi + 'users/id/' + $stateParams.userid) + .then(function(data, status, headers, config) { + console.log('data success'); + console.log(data); // for browser console + $scope.user = data.data; // for UI + if ($scope.storageuser._id == $scope.user._id) { + localStorage.setItem("cim_app_userdata", JSON.stringify(data.data)); + } + $scope.$broadcast('scroll.refreshComplete'); //refresher stop + }, function(data, status, headers, config) { + console.log('data error'); + $scope.$broadcast('scroll.refreshComplete'); //refresher stop }); }; $scope.doRefresh(); - $scope.likeUser = function(){ - $http({ - //url: urlapi + 'users/'+ $stateParams.username+'/fav', - url: urlapi + 'users/id/like/'+ $scope.user._id, - method: "POST", - data: {} + $scope.likeUser = function() { + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/id/like/' + $scope.user._id, + method: "POST", + data: {} }) .then(function(data) { // success - if(data.data.success==false){ - console.log("failed"); - $ionicLoading.show({template: 'Error on like', noBackdrop: true, duration: 2000}); - }else{ - $scope.user = data.data; // for UI + if (data.data.success == false) { + console.log("failed"); + $ionicLoading.show({ + template: 'Error on like', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.user = data.data; // for UI } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.unlikeUser = function(){ - $http({ - //url: urlapi + 'users/'+ $stateParams.username+'/fav', - url: urlapi + 'users/id/unlike/'+ $scope.user._id, - method: "POST", - data: {} + $scope.unlikeUser = function() { + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/id/unlike/' + $scope.user._id, + method: "POST", + data: {} }) .then(function(data) { // success - if(data.data.success==false){ - console.log("failed"); - $ionicLoading.show({template: 'Error on unlike', noBackdrop: true, duration: 2000}); - }else{ - $scope.user = data.data; // for UI + if (data.data.success == false) { + console.log("failed"); + $ionicLoading.show({ + template: 'Error on unlike', + noBackdrop: true, + duration: 2000 + }); + } else { + $scope.user = data.data; // for UI } - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.favUser = function(){ - $scope.newfav={ - //travelId: $stateParams.travelId, - /*userId: localStorage.getItem("c_userid"), - username: localStorage.getItem("c_username"), - avatar: localStorage.getItem("c_avatar")*/ - }; - $scope.user.favs.push($scope.newfav);//al unfav no cal fer aquest simulacre pq ja no existeix a l'array i no el resta dos cops en cas de que cliquin dos cops - $http({ - //url: urlapi + 'users/'+ $stateParams.username+'/fav', - url: urlapi + 'users/'+ $scope.user._id+'/fav', - method: "POST", - data: $scope.newfav + $scope.favUser = function() { + $scope.newfav = { + //travelId: $stateParams.travelId, + /*userId: localStorage.getItem("c_userid"), + username: localStorage.getItem("c_username"), + avatar: localStorage.getItem("c_avatar")*/ + }; + $scope.user.favs.push($scope.newfav); //al unfav no cal fer aquest simulacre pq ja no existeix a l'array i no el resta dos cops en cas de que cliquin dos cops + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/' + $scope.user._id + '/fav', + method: "POST", + data: $scope.newfav }) .then(function(response) { - // success - console.log("response: "); - console.log(response); + // success + console.log("response: "); + console.log(response); - $scope.users=response.data; - localStorage.setItem('c_users', JSON.stringify($scope.users)); - $scope.user = $filter('filter')($scope.users, {username: $stateParams.username}, true)[0]; + $scope.users = response.data; + localStorage.setItem('c_users', JSON.stringify($scope.users)); + $scope.user = $filter('filter')($scope.users, { + username: $stateParams.username + }, true)[0]; - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; - $scope.unfavUser = function(){ - console.log("unfav"); - $scope.unfav={ - /*userId: localStorage.getItem("c_userid"), - username: localStorage.getItem("c_username"), - avatar: localStorage.getItem("c_avatar")*/ - }; - $http({ - //url: urlapi + 'users/'+ $stateParams.username+'/fav', - url: urlapi + 'users/'+ $scope.user._id+'/unfav', - method: "POST", - data: $scope.unfav + $scope.unfavUser = function() { + console.log("unfav"); + $scope.unfav = { + /*userId: localStorage.getItem("c_userid"), + username: localStorage.getItem("c_username"), + avatar: localStorage.getItem("c_avatar")*/ + }; + $http({ + //url: urlapi + 'users/'+ $stateParams.username+'/fav', + url: urlapi + 'users/' + $scope.user._id + '/unfav', + method: "POST", + data: $scope.unfav }) .then(function(response) { - // success - console.log("response: "); - console.log(response); + // success + console.log("response: "); + console.log(response); - $scope.users=response.data; - localStorage.setItem('c_users', JSON.stringify($scope.users)); - $scope.user = $filter('filter')($scope.users, {username: $stateParams.username}, true)[0]; + $scope.users = response.data; + localStorage.setItem('c_users', JSON.stringify($scope.users)); + $scope.user = $filter('filter')($scope.users, { + username: $stateParams.username + }, true)[0]; - }, - function(response) { // optional - // failed - }); + }, + function(response) { // optional + // failed + }); }; $ionicModal.fromTemplateUrl('templates/favsList.html', { @@ -129,21 +140,51 @@ angular.module('app.user', ['pascalprecht.translate']) $scope.closeModalFavsList = function() { $scope.modalFavsList.hide(); }; - $scope.showFavsList = function(){ + $scope.showFavsList = function() { $scope.modalFavsList.show(); }; - $scope.closeModalAndGoUser = function(){ + $scope.closeModalAndGoUser = function() { $scope.modalFavsList.hide(); }; $scope.arrayObjectIndexOf = function(myArray, searchTerm) { - if(myArray){ - for(var i = 0, len = myArray.length; i < len; i++) { - if (myArray[i] === searchTerm){ - return i; - } - } + if (myArray) { + for (var i = 0, len = myArray.length; i < len; i++) { + if (myArray[i] === searchTerm) { + return i; + } } - return -1; + } + return -1; + }; + + //show image + $ionicModal.fromTemplateUrl('templates/imgView.html', { + scope: $scope, + animation: 'slide-in-up' + }).then(function(modal) { + $scope.modal = modal; + }); + $scope.openModal = function() { + $scope.modal.show(); + }; + $scope.closeModal = function() { + $scope.modal.hide(); + }; + // Cleanup the modal when we're done with it! + $scope.$on('$destroy', function() { + $scope.modal.remove(); + }); + // Execute action on hide modal + $scope.$on('modal.hidden', function() { + // Execute action + }); + // Execute action on remove modal + $scope.$on('modal.removed', function() { + // Execute action + }); + $scope.showImg = function() { + console.log("show image"); + $scope.openModal(); }; -}); + }); diff --git a/www/templates/imgView.html b/www/templates/imgView.html new file mode 100644 index 0000000..34b9a1e --- /dev/null +++ b/www/templates/imgView.html @@ -0,0 +1,9 @@ + + + + Back +

{{user.username}} profile image

+
+ +
+
diff --git a/www/templates/notifications.html b/www/templates/notifications.html index f9ffad6..22e6fde 100644 --- a/www/templates/notifications.html +++ b/www/templates/notifications.html @@ -3,25 +3,23 @@
- No notifications yet + No notifications yet
- - -

{{notification.message}}

-
-
{{notification.date | date:"dd/MM"}}
-
{{notification.date | date:"HH:mm:ss"}}
-
-
- - -

{{notification.message}}

-
-
{{notification.date | date:"dd/MM"}}
-
{{notification.date | date:"HH:mm:ss"}}
-
-
+ +
+
{{notification.date | date:"dd/MM"}}
+
{{notification.date | date:"HH:mm:ss"}}
+
+ +

{{notification.message}}

+
+ +
+
{{notification.date | date:"dd/MM"}}
+
{{notification.date | date:"HH:mm:ss"}}
+
+ +

{{notification.message}}

+
diff --git a/www/templates/travel.html b/www/templates/travel.html index d4d5dcf..9a28d58 100644 --- a/www/templates/travel.html +++ b/www/templates/travel.html @@ -51,22 +51,23 @@

- {{'Ask_to_join' | translate}} - {{'Offer_car' | translate}} - {{'Offer_car' | translate}} + {{'Ask_to_join' | translate}} + {{'Offer_car' | translate}} + {{'Offer_car' | translate}}
- {{'Unjoin' | translate}} - {{'Unoffer_car' | translate}} - {{'Unoffer_car' | translate}} + {{'Unjoin' | translate}} + {{'Unoffer_car' | translate}} + {{'Unoffer_car' | translate}}
- {{'Leave' | translate}} - {{'Leave' | translate}} - {{'Leave' | translate}} + You have been accepted! + {{'Leave' | translate}} + {{'Leave' | translate}} + {{'Leave' | translate}}

diff --git a/www/templates/travels.html b/www/templates/travels.html index 6760bd1..01fc34b 100644 --- a/www/templates/travels.html +++ b/www/templates/travels.html @@ -20,6 +20,9 @@ +
+ {{travel.user.username}} +

{{travel.title}}

@@ -34,8 +37,13 @@

-
+ + + diff --git a/www/templates/user.html b/www/templates/user.html index fccb73e..1f753bd 100644 --- a/www/templates/user.html +++ b/www/templates/user.html @@ -1,49 +1,50 @@ - - - + + +
- -

{{user.username}}

-

{{user.description}}

-

{{user.email}}

+ + +

{{user.username}}

+

{{user.description}}

+

{{user.email}}

-

+

{{'view_likes' | translate}}

-

- {{'Edit_profile' | translate}} -

+

+ {{'Edit_profile' | translate}} +

-
- +