arnaucube
arnaucube/commonroutesServerPublic Self-hosted repository
get and show travels from server by app
nau idoctnef@openmailbox.org
Thu, 25 Aug 2016 22:57:16 +0200
commit

a87c5faa5c452ad1da05fb8da14b9559fdaf7cb2

parent

09a59da1e0166077575aa97d9e7d7b5086f4b3a9

56 files changed, 65 insertions(+), 9 deletions(-)

jump to
A app/.io-config.json

@@ -0,0 +1,1 @@

+{"app_id":"0f46f512"}
A app/comandesUtils.txt

@@ -0,0 +1,12 @@

+ +export ANDROID_HOME=~/Android/Sdk/ +PATH=$PATH:$ANDROID_HOME/tools +PATH=$PATH:$ANDROID_HOME/platform-tools + + +cd /home/nau/Android/Sdk/tools +./android + + +ionic serve +ionic build android
M app/config.xml → app/config.xml

@@ -16,7 +16,28 @@ <preference name="SplashScreenDelay" value="2000"/>

<preference name="FadeSplashScreenDuration" value="2000"/> <preference name="android-minSdkVersion" value="16"/> <preference name="BackupWebStorage" value="none"/> + <preference name="SplashScreen" value="screen"/> <feature name="StatusBar"> <param name="ios-package" value="CDVStatusBar" onload="true"/> </feature> + <platform name="android"> + <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/> + <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/> + <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/> + <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/> + <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/> + <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> + <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/> + <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/> + <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/> + <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/> + <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> + <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> + <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/> + <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/> + <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/> + <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/> + <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> + <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> + </platform> </widget>
A app/ionic.config.json

@@ -0,0 +1,4 @@

+{ + "name": "app", + "app_id": "0f46f512" +}
M app/ionic.project → app/ionic.project

@@ -1,4 +1,4 @@

{ "name": "app", - "app_id": "" + "app_id": "0f46f512" }
M app/package.json → app/package.json

@@ -1,7 +1,7 @@

{ - "name": "app", + "name": "collectivecar", "version": "1.1.1", - "description": "app: An Ionic project", + "description": "app: collectivecar", "dependencies": { "gulp": "^3.5.6", "gulp-sass": "^2.0.4",

@@ -23,4 +23,4 @@ "cordova-plugin-statusbar",

"ionic-plugin-keyboard" ], "cordovaPlatforms": [] -}+}
M app/www/js/controllers.js → app/www/js/controllers.js

@@ -42,8 +42,8 @@ };

}) -.controller('TravelsCtrl', function($scope) { - $scope.travels = [ +.controller('TravelsCtrl', function($scope, $http) { + /*$scope.travels = [ { id: 1, title: 'Travel1', description: "description for travel 1", owner: "user1", icon: "car" }, { id: 2, title: 'Travel2', description: "description for travel 2", owner: "user2", icon: "station-wagon" }, { id: 3, title: 'Travel3', description: "description for travel 3", owner: "user3", icon: "van" },

@@ -52,7 +52,20 @@ { id: 5, title: 'Travel5', description: "description for travel 5", owner: "user2", icon: "minivan" },

{ id: 6, title: 'Travel6', description: "description for travel 6", owner: "user3", icon: "lorry" }, { id: 7, title: 'Travel7', description: "description for travel 7", owner: "user1", icon: "sport-car" }, { id: 8, title: 'Travel8', description: "description for travel 8", owner: "user2", icon: "jeep" } - ]; +];*/ + $scope.travels=""; + $http.get('http://localhost:3000/api/travels') + .success(function(data, status, headers,config){ + console.log('data success'); + console.log(data); // for browser console + $scope.travels = data; // for UI + }) + .error(function(data, status, headers,config){ + console.log('data error'); + }) + .then(function(result){ + travels = result.data; + }); }) .controller('TravelCtrl', function($scope, $stateParams) { //$scope.travel=travels.get($stateParams.travelId);
M app/www/templates/menu.html → app/www/templates/menu.html

@@ -24,6 +24,9 @@ </ion-item>

<ion-item menu-close href="#/app/travels"> Travels </ion-item> + <ion-item menu-close href="#/app/browse"> + Transport material + </ion-item> <ion-item menu-close href="#/app/search"> Available cars </ion-item>
M server/controllers/travelController.js → server/controllers/travelController.js

@@ -58,7 +58,8 @@ from: req.body.from,

to: req.body.to, date: req.body.date, generateddate: req.body.generateddate, - seats: req.body.seats + seats: req.body.seats, + icon: req.body.icon }); travel.save(function(err, travel) {
M server/models/travelModel.js → server/models/travelModel.js

@@ -10,6 +10,7 @@ from: { type: String },

to: { type: String }, date: { type: Date }, generateddate: { type: Date }, - seats: { type: Number } + seats: { type: Number }, + icon: { type: String } }) module.exports = mongoose.model('travelModel', travelSchema);