Browse Source

user travels visualization and other updates

master
arnaucode 7 years ago
parent
commit
1c90d841bb
8 changed files with 99 additions and 8 deletions
  1. +4
    -0
      www/css/style.css
  2. +1
    -0
      www/index.html
  3. +10
    -0
      www/js/app.js
  4. +2
    -2
      www/js/menu.js
  5. +23
    -0
      www/js/userTravels.js
  6. +9
    -2
      www/templates/login.html
  7. +4
    -4
      www/templates/user.html
  8. +46
    -0
      www/templates/userTravels.html

+ 4
- 0
www/css/style.css

@ -60,6 +60,10 @@
font-weight: bold;
margin: 10%;
}
.o_signupLink{
text-decoration: none;
color: #ffffff;
}
.o_transparentBackground{
background: rgba(255, 255, 255, 0);
color: #ffffff;

+ 1
- 0
www/index.html

@ -54,6 +54,7 @@
<script src="js/askPackage.js"></script>-->
<script src="js/users.js"></script>
<script src="js/user.js"></script>
<script src="js/userTravels.js"></script>
<script src="js/editUser.js"></script>
<script src="js/notifications.js"></script>
<script src="js/settings.js"></script>

+ 10
- 0
www/js/app.js

@ -30,6 +30,7 @@ angular.module('starter', [
'app.askPackage',*/
'app.users',
'app.user',
'app.userTravels',
'app.editUser',
'app.notifications',
'app.settings',
@ -153,6 +154,15 @@ angular.module('starter', [
}
}
})
.state('app.userTravels', {
url: '/users/userTravels/:userid',
views: {
'menuContent': {
templateUrl: 'templates/userTravels.html',
controller: 'UserTravelsCtrl'
}
}
})
.state('app.editUser', {
url: '/editUser',
views: {

+ 2
- 2
www/js/menu.js

@ -1,7 +1,7 @@
angular.module('app.menu', ['pascalprecht.translate'])
.controller('MenuCtrl', function($scope) {
.controller('MenuCtrl', function($scope, $window) {
if (localStorage.getItem("cim_app_userdata")) {
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
console.log($scope.storageuser);
@ -10,6 +10,6 @@ angular.module('app.menu', ['pascalprecht.translate'])
$scope.logout = function() {
localStorage.removeItem("cim_app_token");
localStorage.removeItem("cim_app_userdata");
window.location = "/";
$window.location.reload(true);
};
});

+ 23
- 0
www/js/userTravels.js

@ -0,0 +1,23 @@
angular.module('app.userTravels', ['pascalprecht.translate'])
.controller('UserTravelsCtrl', function($scope, $http, $ionicModal,
$timeout, $ionicLoading, $filter, $stateParams) {
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
$scope.travels=[];
$scope.joins=[];
$scope.doRefresh = function(){
$http.get(urlapi + 'users/id/travels/'+$stateParams.userid)
.then(function(data, status, headers,config){
console.log('data success');
console.log(data);
$scope.travels = data.data.travels;
$scope.joins = data.data.joins;
$scope.$broadcast('scroll.refreshComplete');//refresher stop
},function(data, status, headers,config){
console.log('data error');
$scope.$broadcast('scroll.refreshComplete');//refresher stop
});
};
$scope.doRefresh();
});

+ 9
- 2
www/templates/login.html

@ -23,17 +23,24 @@
{{'LOG IN' | translate}}
</a>
</p>
<br>
<p>
<a class="o_signupLink" ng-href="#/app/signup">
Not account yet? {{'Create one' | translate}}
</a>
</p>
<!--<p>
<a class="o_loginButton button button-block" ng-href="#/app/signup">
{{'Signup' | translate}}
</a>
</p>-->
</p>
<div class="bar bar-footer o_transparentBackground">
<a class="button o_purple300 pull-right" ng-href="#/app/signup">
<i class="icon ion-android-person-add"></i>
{{'SIGN UP' | translate}}
</a>
</div>
</div>-->
</div>
</div>
</ion-content>

+ 4
- 4
www/templates/user.html

@ -20,13 +20,13 @@
<i class="icon ion-paper-airplane"></i>
@{{user.telegram}}
</a>
<a class="tab-item">
<a class="tab-item" ng-href="#/app/users/userTravels/{{user._id}}">
<i class="icon ion-android-car"></i>
{{user.travels.length}} Travels
</a>
<a class="tab-item">
<i class="icon ion-ios-heart"></i>
{{user.favs.length}} favs
{{user.favs.length}} favs<br>(not yet)
</a>
</div>
@ -47,7 +47,7 @@
<div class="item">
<img src="{{user.faircoin}}" style="width: 100%;" />
</div>
<div class="item item-body">
<!--<div class="item item-body">
{{'current_publications_of' | translate}} {{user.username}}:
<div class="o_text_purple600">{{user.travels.length}} {{'publications' | translate}}</div>
@ -68,6 +68,6 @@
{{travel.description}}
</p>
</a>
</div>
</div>-->
</ion-content>
</ion-view>

+ 46
- 0
www/templates/userTravels.html

@ -0,0 +1,46 @@
<ion-view view-title="{{' travels' | translate}}">
<ion-content class="has-footer">
<ion-refresher
pulling-text="{{'Pull_to_refresh' | translate}}..."
on-refresh="doRefresh()">
</ion-refresher>
<div class="list">
<div class="item item-divider o_purple300" ng-show="travels[0]">
Travels offering
</div>
<a ng-repeat="travel in travels | orderBy: 'date'"
class="item item-icon-left" href="#/app/travels/{{travel._id}}">
<i class="icon ion-android-car o_text_grey700"></i>
<h2 class="o_text_grey800">{{travel.title}}</h2>
<div class="item-note text-right">
<div class="o_text_purple300">{{travel.date | date:"dd/MM"}}</div>
<div class="o_text_purple300">{{travel.date | date:"HH:mm"}}h</div>
</div>
<p>
{{travel.from.name}}
</p>
<p>
{{travel.to.name}}
</p>
</a>
<div class="item item-divider o_purple300" ng-show="joins[0]">
Travels joining
</div>
<a ng-repeat="travel in joins | orderBy: 'date'"
class="item item-icon-left" href="#/app/travels/{{travel._id}}">
<i class="icon ion-android-car o_text_grey700"></i>
<h2 class="o_text_grey800">{{travel.title}}</h2>
<div class="item-note text-right">
<div class="o_text_purple300">{{travel.date | date:"dd/MM"}}</div>
<div class="o_text_purple300">{{travel.date | date:"HH:mm"}}h</div>
</div>
<p>
{{travel.from.name}}
</p>
<p>
{{travel.to.name}}
</p>
</a>
</div>
</ion-content>
</ion-view>

Loading…
Cancel
Save