Browse Source

fav icons

master
idoctnef 8 years ago
parent
commit
999c2c025c
6 changed files with 26 additions and 10 deletions
  1. BIN
      www/img/like.png
  2. BIN
      www/img/unlike.png
  3. +13
    -5
      www/js/controllers.js
  4. +4
    -0
      www/templates/signup.html
  5. +1
    -1
      www/templates/travel.html
  6. +8
    -4
      www/templates/user.html

BIN
www/img/like.png

Before After
Width: 32  |  Height: 32  |  Size: 722 B

BIN
www/img/unlike.png

Before After
Width: 32  |  Height: 32  |  Size: 793 B

+ 13
- 5
www/js/controllers.js

@ -73,13 +73,16 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
localStorage.setItem("c_avatar", response.data.avatar);
localStorage.setItem("c_userdata", JSON.stringify(response.data.userdata));
$timeout(function() {
$scope.closeLogin();
$window.location.reload(true);
}, 1000);
}else{
console.log("login failed");
$ionicLoading.show({ template: 'Login failed, user or password error.', noBackdrop: true, duration: 2000 });
}
$timeout(function() {
$scope.closeLogin();
$window.location.reload(true);
}, 1000);
},
function(response) { // optional
@ -101,6 +104,7 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
// success
console.log("response: ");
console.log(response.data);
$scope.loginData.username=$scope.signupData.username;
$timeout(function() {
$scope.closeSignup();
$scope.login();
@ -202,7 +206,6 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
}*/
$scope.travels="";
$scope.travels=JSON.parse(localStorage.getItem('c_travels'));
$scope.userdata=JSON.parse(localStorage.getItem('c_userdata'));
console.log($scope.userdata);
@ -467,6 +470,10 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
})
.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
@ -685,6 +692,7 @@ console.log($scope.newComment);
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',

+ 4
- 0
www/templates/signup.html

@ -28,6 +28,10 @@
<span class="input-label">{{'Telegram' | translate }}</span>
<input type="text" ng-model="signupData.telegram">
</label>
<label class="item item-input">
<span class="input-label">{{'Description' | translate }}</span>
<input type="text" ng-model="signupData.description">
</label>
<!--<label class="item item-input">
<span class="input-label">{{'Avatar' | translate }}</span>
<input type="text" ng-model="signupData.avatar">

+ 1
- 1
www/templates/travel.html

@ -7,7 +7,7 @@
<a class="o-badge-calm" href="#/app/users/{{travel.owner}}">{{travel.owner}}</a>
</p>
<p ng-show="storageusername==travel.owner" class="text-right">
<a href="#" ng-click="deleteTravel()" class="button button-small button-assertive o-pull-right"><i class="icon ion-trash-a"></i></a>
<a ng-click="deleteTravel()" class="button button-small button-assertive o-pull-right"><i class="icon ion-trash-a"></i></a>
</p>
</div>
<h2>{{travel.title}}</h2>

+ 8
- 4
www/templates/user.html

@ -13,11 +13,15 @@
<div class="o-text-right">
<b>favs:</b>
<span class="o-badge-calm">{{user.favs.length}}</span>
<br>
<span class="">{{user.favs.length}}</span>
<br><br>
<div ng-show="storageusername && storageusername!=user.username">
<a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')==-1" ng-click="favUser()" class="button button-calm o-pull-right">+1</a>
<a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')!=-1" ng-click="unfavUser()" class="button button-assertive o-pull-right">unfav</a>
<a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')==-1" ng-click="favUser()">
<img class="o-imgMenu" src="img/unlike.png" />
</a>
<a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')!=-1" ng-click="unfavUser()">
<img class="o-imgMenu" src="img/like.png" />
</a>
</div>
<!--<a ng-repeat="join in user.favs" ng-href="#/app/users/{{join.joinedUsername}}" class="button button-small button-dark">
<img ng-src="img/avatars/{{join.joinedAvatar}}.png" class="o-img-joined" />{{join.joinedUsername}}<br>

Loading…
Cancel
Save