From d714f61597bf47dbccaa33bc12fb8e2ed61de0ef Mon Sep 17 00:00:00 2001 From: idoctnef Date: Wed, 5 Oct 2016 12:45:25 +0200 Subject: [PATCH] signup avatars selector --- comandesUtils.txt | 7 +++ www/css/style.css | 4 ++ www/js/controllers.js | 100 ++++++++++++++++++++++++++++++-------- www/templates/signup.html | 6 ++- 4 files changed, 94 insertions(+), 23 deletions(-) diff --git a/comandesUtils.txt b/comandesUtils.txt index 428ea6e..15fadb6 100644 --- a/comandesUtils.txt +++ b/comandesUtils.txt @@ -3,7 +3,14 @@ export ANDROID_HOME=~/Android/Sdk/ PATH=$PATH:$ANDROID_HOME/tools PATH=$PATH:$ANDROID_HOME/platform-tools +** cal estar amb sudo ** +#current path: +export ANDROID_HOME=home/nau/sourceProgramsToInstall/android-sdk-linux/ +export PATH=$PATH:$ANDROID_HOME:/home/nau/sourceProgramsToInstall/android-sdk-linux/tools +export PATH=$PATH:$ANDROID_HOME/home/nau/sourceProgramsToInstall/android-sdk-linux/platform-tools + +#run android sdk manager tools: cd /home/nau/Android/Sdk/tools ./android diff --git a/www/css/style.css b/www/css/style.css index 24afea2..cef31f2 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -7,6 +7,10 @@ width: 40px!important; height: 40px!important; } +.o-imgSelectAvatar{ + width: 45px!important; + height: 45px!important; +} .o-bold{ font-weight: bold!important; } diff --git a/www/js/controllers.js b/www/js/controllers.js index 4ccffad..a407ba7 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -1,6 +1,6 @@ -var urlapi="http://localhost:3000/api/"; -//var urlapi="https://collectivecar.paas.primustech.io/api/"; +//var urlapi="http://localhost:3000/api/"; +var urlapi="https://collectivecar.paas.primustech.io/api/"; //localStorage.setItem("c_username", "user2"); @@ -9,7 +9,7 @@ var urlapi="http://localhost:3000/api/"; angular.module('starter.controllers', ['pascalprecht.translate']) -.controller('AppCtrl', function($scope, $ionicModal, $timeout, $http, $window) { +.controller('AppCtrl', function($scope, $ionicModal, $timeout, $http, $window, $ionicLoading) { // With the new view caching in Ionic, Controllers are only called // when they are recreated or on app start, instead of every page change. // To listen for when this page is active (for example, to refresh data), @@ -88,25 +88,83 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }; $scope.doSignup = function() { console.log('Doing signup', $scope.signupData); + if($scope.emptyParams($scope.signupData)) + { + $http({ + url: urlapi + 'users', + method: "POST", + data: $scope.signupData + }) + .then(function(response) { + // success + console.log("response: "); + console.log(response.data); + $timeout(function() { + $scope.closeSignup(); + $scope.login(); + }, 1000); + + }, + function(response) { // optional + // failed + }); + }else{ + $ionicLoading.show({ template: 'First complete all parameters', noBackdrop: true, duration: 2000 }); + } - $http({ - url: urlapi + 'users', - method: "POST", - data: $scope.signupData - }) - .then(function(response) { - // success - console.log("response: "); - console.log(response.data); - $timeout(function() { - $scope.closeSignup(); - }, 1000); - - }, - function(response) { // optional - // failed - }); - + }; + $scope.emptyParams = function(obj){ + if(obj.username==undefined) + { + return(false); + } + if(obj.password==undefined) + { + return(false); + } + if(obj.mail==undefined) + { + return(false); + } + if(obj.phone==undefined) + { + return(false); + } + if(obj.avatar==undefined) + { + return(false); + } + return(true); + }; + $scope.avatars=[ + "turtle", + "cat", + "toucan", + "racoon", + "tiger", + "squirrel", + "sheep", + "penguin", + "panda", + "owl", + "pelican", + "whale", + "snake", + "mouse", + "giraffe", + "macaw", + "lion", + "llama", + "kangaroo", + "hen", + "frog", + "clown-fish", + "chameleon", + "octopus" + ]; + $scope.avatarSelect = function(avat){ + $scope.signupData.avatar=avat; + //alert($scope.signupData.avatar); }; $scope.logout = function(){ localStorage.removeItem("c_username"); diff --git a/www/templates/signup.html b/www/templates/signup.html index 652a2ab..6598678 100644 --- a/www/templates/signup.html +++ b/www/templates/signup.html @@ -28,10 +28,12 @@ {{'Telegram' | translate }} -