mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 03:26:44 +01:00
signup avatars selector
This commit is contained in:
@@ -3,7 +3,14 @@ export ANDROID_HOME=~/Android/Sdk/
|
|||||||
PATH=$PATH:$ANDROID_HOME/tools
|
PATH=$PATH:$ANDROID_HOME/tools
|
||||||
PATH=$PATH:$ANDROID_HOME/platform-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
|
cd /home/nau/Android/Sdk/tools
|
||||||
./android
|
./android
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
width: 40px!important;
|
width: 40px!important;
|
||||||
height: 40px!important;
|
height: 40px!important;
|
||||||
}
|
}
|
||||||
|
.o-imgSelectAvatar{
|
||||||
|
width: 45px!important;
|
||||||
|
height: 45px!important;
|
||||||
|
}
|
||||||
.o-bold{
|
.o-bold{
|
||||||
font-weight: bold!important;
|
font-weight: bold!important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
var urlapi="http://localhost:3000/api/";
|
//var urlapi="http://localhost:3000/api/";
|
||||||
//var urlapi="https://collectivecar.paas.primustech.io/api/";
|
var urlapi="https://collectivecar.paas.primustech.io/api/";
|
||||||
|
|
||||||
|
|
||||||
//localStorage.setItem("c_username", "user2");
|
//localStorage.setItem("c_username", "user2");
|
||||||
@@ -9,7 +9,7 @@ var urlapi="http://localhost:3000/api/";
|
|||||||
|
|
||||||
angular.module('starter.controllers', ['pascalprecht.translate'])
|
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
|
// With the new view caching in Ionic, Controllers are only called
|
||||||
// when they are recreated or on app start, instead of every page change.
|
// 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),
|
// To listen for when this page is active (for example, to refresh data),
|
||||||
@@ -88,26 +88,84 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
|
|||||||
};
|
};
|
||||||
$scope.doSignup = function() {
|
$scope.doSignup = function() {
|
||||||
console.log('Doing signup', $scope.signupData);
|
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);
|
||||||
|
|
||||||
$http({
|
},
|
||||||
url: urlapi + 'users',
|
function(response) { // optional
|
||||||
method: "POST",
|
// failed
|
||||||
data: $scope.signupData
|
});
|
||||||
})
|
}else{
|
||||||
.then(function(response) {
|
$ionicLoading.show({ template: 'First complete all parameters', noBackdrop: true, duration: 2000 });
|
||||||
// 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(){
|
$scope.logout = function(){
|
||||||
localStorage.removeItem("c_username");
|
localStorage.removeItem("c_username");
|
||||||
localStorage.removeItem("c_token");
|
localStorage.removeItem("c_token");
|
||||||
|
|||||||
@@ -28,10 +28,12 @@
|
|||||||
<span class="input-label">{{'Telegram' | translate }}</span>
|
<span class="input-label">{{'Telegram' | translate }}</span>
|
||||||
<input type="text" ng-model="signupData.telegram">
|
<input type="text" ng-model="signupData.telegram">
|
||||||
</label>
|
</label>
|
||||||
<label class="item item-input">
|
<!--<label class="item item-input">
|
||||||
<span class="input-label">{{'Avatar' | translate }}</span>
|
<span class="input-label">{{'Avatar' | translate }}</span>
|
||||||
<input type="text" ng-model="signupData.avatar">
|
<input type="text" ng-model="signupData.avatar">
|
||||||
</label>
|
</label>-->
|
||||||
|
<p>{{'Avatar' | translate }}: <b>{{signupData.avatar}}</b></p>
|
||||||
|
<img ng-repeat="avatar in avatars" ng-click="avatarSelect('{{avatar}}')" ng-src="img/avatars/{{avatar}}.png" class="o-imgSelectAvatar" >
|
||||||
|
|
||||||
<label class="item">
|
<label class="item">
|
||||||
<button class="button button-block button-positive" type="submit">{{'Signup' | translate }}</button>
|
<button class="button button-block button-positive" type="submit">{{'Signup' | translate }}</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user