diff --git a/www/css/style.css b/www/css/style.css
index fa65cc3..8d164d9 100644
--- a/www/css/style.css
+++ b/www/css/style.css
@@ -201,6 +201,9 @@
}
+.o_text_white{
+ color: #ffffff!important;
+}
.o_text_purple400{
color: #7E57C2!important;
}
@@ -210,3 +213,9 @@
.o_text_purple600{
color: #5E35B1!important;
}
+.o_text_purple700{
+ color: #512DA8!important;
+}
+.o_text_purple800{
+ color: #4527A0!important;
+}
diff --git a/www/img/faircoinpublickey_sample.png b/www/img/faircoinpublickey_sample.png
index 8704a8b..6932043 100644
Binary files a/www/img/faircoinpublickey_sample.png and b/www/img/faircoinpublickey_sample.png differ
diff --git a/www/index.html b/www/index.html
index ef07206..8fd539f 100644
--- a/www/index.html
+++ b/www/index.html
@@ -3,7 +3,7 @@
- collectivecar
+ CarsInCommon
@@ -38,9 +38,10 @@
+
-
+
diff --git a/www/js/app.js b/www/js/app.js
index 11962b0..01d28e7 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -6,8 +6,9 @@
// 'starter.controllers' is found in controllers.js
-var urlapi = "http://localhost:3000/api/";
+//var urlapi = "http://localhost:3000/api/";
//var urlapi="https://collectivecar.paas.primustech.io/api/";
+var urlapi="http://147.83.7.158:3000/api/";
angular.module('starter', [
@@ -19,9 +20,10 @@ angular.module('starter', [
'app.menu',
'app.footerMenu',
'app.main',
+ 'app.search',
'app.travels',
'app.travel',
- 'app.newPublication',
+ 'app.newTravel',
'app.offerCar',
/* 'app.askCar',
'app.askPackage',*/
@@ -84,6 +86,15 @@ angular.module('starter', [
}
}
})
+ .state('app.search', {
+ url: '/search',
+ views: {
+ 'menuContent': {
+ templateUrl: 'templates/search.html',
+ controller: 'SearchCtrl'
+ }
+ }
+ })
.state('app.travels', {
url: '/travels',
views: {
@@ -104,12 +115,12 @@ angular.module('starter', [
}
})
- .state('app.newPublication', {
- url: '/newPublication',
+ .state('app.newTravel', {
+ url: '/newTravel',
views: {
'menuContent': {
- templateUrl: 'templates/newPublication.html',
- controller: 'NewPublicationCtrl'
+ templateUrl: 'templates/newTravel.html',
+ controller: 'NewTravelCtrl'
}
}
})
diff --git a/www/js/newPublication.js b/www/js/newPublication.js
deleted file mode 100644
index 1415c4d..0000000
--- a/www/js/newPublication.js
+++ /dev/null
@@ -1,5 +0,0 @@
-angular.module('app.newPublication', ['pascalprecht.translate'])
-
-.controller('NewPublicationCtrl', function($scope, $stateParams, $translate, $filter) {
-
-});
diff --git a/www/js/newTravel.js b/www/js/newTravel.js
new file mode 100644
index 0000000..62a5c74
--- /dev/null
+++ b/www/js/newTravel.js
@@ -0,0 +1,5 @@
+angular.module('app.newTravel', ['pascalprecht.translate'])
+
+.controller('NewTravelCtrl', function($scope, $stateParams, $translate, $filter) {
+
+});
diff --git a/www/js/notifications.js b/www/js/notifications.js
index 10f532b..d254751 100644
--- a/www/js/notifications.js
+++ b/www/js/notifications.js
@@ -1,15 +1,21 @@
angular.module('app.notifications', ['pascalprecht.translate'])
-.controller('NotificationsCtrl', function($scope, $stateParams, $translate, $filter) {
- if(localStorage.getItem('c_token')){// adding token to the headers
- // $http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token');
- }
- $scope.storageusername=localStorage.getItem("c_username");
- $scope.users= JSON.parse(localStorage.getItem('c_users'));
- $scope.user = $filter('filter')($scope.users, {username: $stateParams.username}, true)[0];
- $scope.notifications=$scope.user.notifications;
+.controller('NotificationsCtrl', function($scope, $http, $ionicLoading,
+ $stateParams, $translate, $filter) {
+ $scope.notifications=[];
+ $scope.doRefresh = function(){
+ $http.get(urlapi + 'notifications')
+ .then(function(data){
+ console.log(data); // for browser console
+ $scope.notifications = data.data; // for UI
+ $scope.$broadcast('scroll.refreshComplete');//refresher stop
- console.log($stateParams.username);
- console.log($scope.notifications);
- console.log("notifications page");
+ }, function(data){
+ console.log('data error');
+ $scope.$broadcast('scroll.refreshComplete');//refresher stop
+ $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
+
+ });
+ };
+ $scope.doRefresh();
});
diff --git a/www/js/search.js b/www/js/search.js
new file mode 100644
index 0000000..3705013
--- /dev/null
+++ b/www/js/search.js
@@ -0,0 +1,30 @@
+angular.module('app.search', ['pascalprecht.translate'])
+
+.controller('SearchCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
+
+
+ $scope.users=[];
+ $scope.travels=[];
+ $scope.search={
+ word:""
+ };
+ $scope.doSearch = function() {
+ console.log("doing search");
+ console.log($scope.search.word);
+ /* travels refresh: */
+ $http.get(urlapi + 'search/'+ $scope.search.word)
+ .then(function(data){
+ console.log('data success travels');
+ console.log(data); // for browser console
+ $scope.users = data.data.users; // for UI
+ $scope.travels = data.data.travels; // for UI
+ $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 });
+
+ });
+ };
+});
diff --git a/www/js/translations.js b/www/js/translations.js
index faaaa11..4604d97 100644
--- a/www/js/translations.js
+++ b/www/js/translations.js
@@ -5,6 +5,7 @@ var translations = {
"Signup": "Signup",
"Login": "Login",
"Travels": "Travels",
+ "Travels_feed": "Travels feed",
"Users": "Users",
"Notifications": "Notifications",
"Logout": "Logout",
@@ -50,6 +51,7 @@ var translations = {
"Post_comment": "Post comment",
"Pull_to_refresh": "Pull to refresh",
"search": "search",
+ "filter": "filter",
"No_data_in_memory": "No data in memory",
"Pull_from_top_to_refresh": "Pull from top to refresh",
"User": "User",
diff --git a/www/js/travel.js b/www/js/travel.js
index 478c28b..05c8892 100644
--- a/www/js/travel.js
+++ b/www/js/travel.js
@@ -1,6 +1,6 @@
angular.module('app.travel', ['pascalprecht.translate'])
-.controller('TravelCtrl', function($scope, $stateParams, $http, $ionicModal, $ionicPopup, $filter) {
+.controller('TravelCtrl', function($scope, $stateParams, $http, $ionicModal, $ionicLoading, $ionicPopup, $filter) {
$scope.travel={};
$scope.doRefresh = function() {
@@ -53,55 +53,38 @@ angular.module('app.travel', ['pascalprecht.translate'])
};
$scope.joinTravel = function(){
- $scope.newjoin={
- //travelId: $stateParams.travelId,
- /*joinedUserId: localStorage.getItem("c_userid"),
- joinedUsername: localStorage.getItem("c_username"),
- joinedAvatar: localStorage.getItem("c_avatar")*/
- };
$http({
- url: urlapi + 'travels/'+ $stateParams.travelId+'/join',
+ url: urlapi + 'travels/join/'+ $stateParams.travelid,
method: "POST",
- data: $scope.newjoin
+ data: {}
})
- .then(function(response) {
- // success
- console.log("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];
-
+ .then(function(data) {
+ console.log("data: ");
+ console.log(data);
+ if(data.success==false){
+ $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000});
+ }else{
+ $scope.travel=data.data;
+ }
},
function(response) { // optional
// failed
});
};
$scope.unjoinTravel = function(){
- console.log("unjoin");
- $scope.unjoin={
- travelId: $stateParams.travelId,
- /*joinedUserId: localStorage.getItem("c_userid"),
- joinedUsername: localStorage.getItem("c_username"),
- joinedAvatar: localStorage.getItem("c_avatar")*/
- };
$http({
- url: urlapi + 'travels/'+ $stateParams.travelId+'/unjoin',
+ url: urlapi + 'travels/unjoin/'+ $stateParams.travelid,
method: "POST",
- data: $scope.unjoin
+ data: {}
})
- .then(function(response) {
- // success
- console.log("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];
-
+ .then(function(data) {
+ console.log("data: ");
+ console.log(data);
+ if(data.success==false){
+ $ionicLoading.show({template: 'Error on unjoin', noBackdrop: true, duration: 2000});
+ }else{
+ $scope.travel=data.data;
+ }
},
function(response) { // optional
// failed
@@ -149,12 +132,13 @@ console.log($scope.newComment);
};
- $scope.arrayObjectIndexOf = function(myArray, searchTerm, property) {
+ $scope.userHasJoined = function(myArray, searchTerm) {
//console.log(myArray+", "+searchTerm+", "+property);
if(myArray)
{
for(var i = 0, len = myArray.length; i < len; i++) {
- if (myArray[i][property] === searchTerm){
+ //console.log(myArray[i] + " - " + searchTerm);
+ if (myArray[i] === searchTerm){
//console.log("i: " + i);
return i;
}
diff --git a/www/templates/login.html b/www/templates/login.html
index f441515..02856b3 100644
--- a/www/templates/login.html
+++ b/www/templates/login.html
@@ -3,6 +3,7 @@