Browse Source

post new offering travel, and user page

master
arnaucode 7 years ago
parent
commit
17f0f740d8
15 changed files with 181 additions and 108 deletions
  1. +89
    -44
      www/css/style.css
  2. +29
    -2
      www/js/app.js
  3. +2
    -1
      www/js/footerMenu.js
  4. +1
    -1
      www/js/login.js
  5. +5
    -2
      www/js/menu.js
  6. +19
    -1
      www/js/offerCar.js
  7. +2
    -2
      www/js/signup.js
  8. +4
    -22
      www/js/user.js
  9. +4
    -4
      www/templates/main.html
  10. +14
    -14
      www/templates/menu.html
  11. +3
    -6
      www/templates/offerCar.html
  12. +1
    -1
      www/templates/signup.html
  13. +1
    -1
      www/templates/travels.html
  14. +6
    -6
      www/templates/user.html
  15. +1
    -1
      www/templates/users.html

+ 89
- 44
www/css/style.css

@ -1,50 +1,95 @@
/* Empty. Add your own CSS if you like */
.o-imgMenu{
width: 25px!important;
height: 25px!important;
.o_noPaddingMargin{
padding: 0!important;
margin: 0!important;
} }
.o-imgTitle{
width: 40px!important;
height: 40px!important;
.o_mainRow{
height: calc(100%/4);
} }
.o-imgSelectAvatar{
width: 45px!important;
height: 45px!important;
.o_floatRight{
float: right;
} }
.o-bold{
font-weight: bold!important;
/*
SISTEMA DE COLORS
users: blue
routines: red
diets: yellow
la nomenclatura és:
o_bColor
la 'o' és de 'own', per saber que és una classe pròpia nostra i que no colisioni amb les classes dels frameworks css
la 'b' és de background, si és una 'f' és de font
a part podem posar ColorDark o ColorLight per fer un color més fosc o més clar
*/
.o_bSidenav{
background: #333b42!important;
color: #c6ccd2!important;
} }
.o-float-right{
float: right;
.o_fWhiteLight{
color: #c6ccd2!important;
}
.o_bGrey{
background: #e6e6e6!important;
color: #000000!important;
}
.o_bGreyLight{
background: #CFD8DC!important;
color: #000000!important;
}
/* backgrounds color: bColor */
.o_bRed{
background: rgb(252,87,85)!important;
color: #ffffff!important;
}
.o_bRedLight{
background: #E57373!important;
color: #ffffff!important;
}
.o_bRedDark{
background: rgb(218, 89, 120)!important;
color: #ffffff!important;
}
.o_bGreen{
background: rgb(123,195,70)!important;
color: #ffffff!important;
}
.o_bGreenLight{
background: #81C784!important;
color: #ffffff!important;
}
.o_bGreenDark{
background: rgb(54,188,155)!important;
color: #ffffff!important;
}
.o_bBlue{
background: rgb(104,195,240)!important;
color: #ffffff!important;
}
.o_bBlueDark{
background: rgb(72,118,180)!important;
color: #ffffff!important;
}
.o_bYellow{
background: rgb(251,187,61)!important;
color: #ffffff!important;
}
.o_bYellowDark{
background: #F9A825!important;
color: #ffffff!important;
}
.o_bOrange{
background: rgb(251, 126, 61)!important;
color: #ffffff!important;
}
.o_bOrangeDark{
background: #FF7043!important;
color: #ffffff!important;
}
.o_bPurple{
background: #9575CD!important;
color: #ffffff!important;
} }
.o-text-right{
text-align: right;
}
.o-mini-text{
font-size: 12px;
display: inline-block;
}
.o-img-joined{
width: 20px!important;
height: 20px!important;
}
.o-img-new{
width: 30px!important;
height: 30px!important;
}
.o-badgeCollectivized{
background: #33CD5F;
padding: 5px;
border-radius: 5px;
font-size: 12px;
color: #ffffff;
font-weight: bold;
}
.o-badge-calm{
background: #11C1F3;
padding: 5px;
border-radius: 7px;
font-size: 12px;
color: #ffffff;
font-weight: bold;
.o_bPurpleDark{
background: #512DA8!important;
color: #ffffff!important;
} }

+ 29
- 2
www/js/app.js

@ -131,7 +131,7 @@ angular.module('starter', [
} }
}) })
.state('app.user', { .state('app.user', {
url: '/users/:username',
url: '/users/:userid',
views: { views: {
'menuContent': { 'menuContent': {
templateUrl: 'templates/user.html', templateUrl: 'templates/user.html',
@ -201,4 +201,31 @@ angular.module('starter', [
$translateProvider.useSanitizeValueStrategy('escape'); $translateProvider.useSanitizeValueStrategy('escape');
}]);
}])
.factory('httpInterceptor', function httpInterceptor($q, $window, $location) {
return {
request: function (config) {
return config;
},
requestError: function (config) {
return config;
},
response: function (res) {
return res;
},
responseError: function (res) {
return res;
}
}
})
.factory('api', function ($http) {
return {
init: function () {
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem("cim_app_token");
$http.defaults.headers.post['X-Access-Token'] = localStorage.getItem("cim_app_token");
}
};
})
.run(function (api) {
api.init();
});

+ 2
- 1
www/js/footerMenu.js

@ -1,5 +1,6 @@
angular.module('app.footerMenu', ['pascalprecht.translate']) angular.module('app.footerMenu', ['pascalprecht.translate'])
.controller('FooterMenuCtrl', function($scope, $stateParams, $translate, $filter) { .controller('FooterMenuCtrl', function($scope, $stateParams, $translate, $filter) {
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
console.log($scope.storageuser);
}); });

+ 1
- 1
www/js/login.js

@ -9,7 +9,7 @@ angular.module('app.login', ['pascalprecht.translate'])
console.log('Doing login', $scope.loginData); console.log('Doing login', $scope.loginData);
$http({ $http({
url: urlapi + 'auth',
url: urlapi + 'login',
method: "POST", method: "POST",
data: $scope.loginData data: $scope.loginData
}) })

+ 5
- 2
www/js/menu.js

@ -2,8 +2,11 @@ angular.module('app.menu', ['pascalprecht.translate'])
.controller('MenuCtrl', function($scope) { .controller('MenuCtrl', function($scope) {
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
console.log($scope.storageuser);
if (localStorage.getItem("cim_app_userdata")) {
$scope.storageuser = JSON.parse(localStorage.getItem("cim_app_userdata"));
console.log($scope.storageuser);
}
$scope.logout = function() { $scope.logout = function() {
localStorage.removeItem("cim_app_token"); localStorage.removeItem("cim_app_token");
localStorage.removeItem("cim_app_userdata"); localStorage.removeItem("cim_app_userdata");

+ 19
- 1
www/js/offerCar.js

@ -1,5 +1,23 @@
angular.module('app.offerCar', ['pascalprecht.translate']) angular.module('app.offerCar', ['pascalprecht.translate'])
.controller('OfferCarCtrl', function($scope, $stateParams, $translate, $filter) {
.controller('OfferCarCtrl', function($scope, $stateParams, $translate,
$http, $filter) {
$scope.newtravel={};
$scope.createTravel =function(){
$scope.newtravel.type="offering";
$http({
url: urlapi + 'travels',
method: "POST",
data: $scope.newtravel
})
.then(function(data) {
console.log(data);
window.location="#app/travels"
},
function(data) { // optional
// failed
console.log(data);
});
};
}); });

+ 2
- 2
www/js/signup.js

@ -6,7 +6,7 @@ angular.module('app.signup', ['pascalprecht.translate'])
console.log('Doing signup', $scope.signupData); console.log('Doing signup', $scope.signupData);
if ($scope.emptyParams($scope.signupData)) { if ($scope.emptyParams($scope.signupData)) {
$http({ $http({
url: urlapi + 'users',
url: urlapi + 'signup',
method: "POST", method: "POST",
data: $scope.signupData data: $scope.signupData
}) })
@ -49,7 +49,7 @@ angular.module('app.signup', ['pascalprecht.translate'])
if (obj.password == undefined) { if (obj.password == undefined) {
return (false); return (false);
} }
if (obj.mail == undefined) {
if (obj.email == undefined) {
return (false); return (false);
} }
/*if(obj.avatar==undefined) /*if(obj.avatar==undefined)

+ 4
- 22
www/js/user.js

@ -1,32 +1,14 @@
angular.module('app.user', ['pascalprecht.translate']) angular.module('app.user', ['pascalprecht.translate'])
.controller('UserCtrl', function($scope, $stateParams, $http, $filter, $ionicModal) { .controller('UserCtrl', function($scope, $stateParams, $http, $filter, $ionicModal) {
if(localStorage.getItem('c_token')){// adding token to the headers
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token');
}
$scope.storageusername=localStorage.getItem("c_username");
$scope.users= JSON.parse(localStorage.getItem('c_users'));
$scope.user = $filter('filter')($scope.users, {username: $stateParams.username}, true)[0];
//$scope.user="";
console.log($stateParams.username);
/*$http.get(urlapi + 'users/byusername/'+$stateParams.username)
.success(function(data, status, headers,config){
console.log('data success');
console.log(data); // for browser console
$scope.user = data; // for UI
})
.error(function(data, status, headers,config){
console.log('data error');
})
.then(function(result){
user = result.data;
});*/
$http.get(urlapi + 'travels/user/'+$stateParams.username)
$scope.user={};
$http.get(urlapi + 'users/getByUserId/'+$stateParams.userid)
.success(function(data, status, headers,config){ .success(function(data, status, headers,config){
console.log('data success'); console.log('data success');
console.log(data); // for browser console console.log(data); // for browser console
$scope.travels = data; // for UI
$scope.user = data; // for UI
}) })
.error(function(data, status, headers,config){ .error(function(data, status, headers,config){
console.log('data error'); console.log('data error');

+ 4
- 4
www/templates/main.html

@ -1,18 +1,18 @@
<ion-view view-title="Main"> <ion-view view-title="Main">
<ion-content> <ion-content>
<a ng-href="#/app/user/{{storageuser._id}}" class="item item-icon-left o_bBlue">
<a ng-href="#/app/travels" class="item item-icon-left o_bGreenDark">
<i class="icon ion-android-car"></i> <i class="icon ion-android-car"></i>
Travels Travels
</a> </a>
<a href="#/app/dashboard" class="item item-icon-left o_bGreen">
<a href="#/app/users" class="item item-icon-left o_bBlue">
<i class="icon ion-person-stalker"></i> <i class="icon ion-person-stalker"></i>
Users Users
</a> </a>
<a href="#/app/marks/{{storageuser._id}}" class="item item-icon-left o_bOrange">
<a href="#/app/settings" class="item item-icon-left o_bOrange">
<i class="icon ion-settings"></i> <i class="icon ion-settings"></i>
Settings Settings
</a> </a>
<a href="#/app/runs/{{storageuser._id}}" class="item item-icon-left o_bPurple">
<a href="#/app/help" class="item item-icon-left">
<i class="icon ion-ios-help-outline"></i> <i class="icon ion-ios-help-outline"></i>
Help Help
</a> </a>

+ 14
- 14
www/templates/menu.html

@ -1,6 +1,6 @@
<ion-side-menus enable-menu-with-back-views="false"> <ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content> <ion-side-menu-content>
<ion-nav-bar class="bar-calm" ng-show="storageuser">
<ion-nav-bar class="bar-stable" ng-show="storageuser">
<ion-nav-back-button> <ion-nav-back-button>
</ion-nav-back-button> </ion-nav-back-button>
@ -11,7 +11,7 @@
</ion-nav-bar> </ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view> <ion-nav-view name="menuContent"></ion-nav-view>
<!-- menu footer --> <!-- menu footer -->
<div class="tabs tabs-icon-left" ng-controller="FooterMenuCtrl" ng-show="storageuser" ng-hide="location=='message'">
<div class="tabs tabs-icon-left" ng-controller="FooterMenuCtrl" ng-show="storageuser">
<a class="tab-item" ng-href="#/app/notifications"> <a class="tab-item" ng-href="#/app/notifications">
<i class="icon ion-android-notifications-none"></i> Notifications <i class="icon ion-android-notifications-none"></i> Notifications
</a> </a>
@ -25,36 +25,36 @@
<!-- /menu footer --> <!-- /menu footer -->
</ion-side-menu-content> </ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-positive">
<h1 class="title">{{'Menu' | translate }}</h1>
<ion-side-menu side="left" class="o_bSidenav">
<ion-header-bar class="bar-stable o_bSidenav">
<h1 class="title o_fWhiteLight">{{'Menu' | translate }}</h1>
</ion-header-bar> </ion-header-bar>
<ion-content> <ion-content>
<ion-list> <ion-list>
<a class="item item-icon-left" menu-close href="#/app/main">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/main">
<i class="icon ion-home"></i> {{'Main' | translate }} <i class="icon ion-home"></i> {{'Main' | translate }}
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/users/{{storageuser}}" ng-show="storageuser">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/users/{{storageuser._id}}">
<i class="icon ion-person"></i> {{storageuser.username}} <i class="icon ion-person"></i> {{storageuser.username}}
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/travels">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/travels">
<i class="icon ion-android-car"></i> {{'Travels' | translate }} <i class="icon ion-android-car"></i> {{'Travels' | translate }}
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/users">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/users">
<i class="icon ion-person-stalker"></i> {{'Users' | translate }} <i class="icon ion-person-stalker"></i> {{'Users' | translate }}
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/notifications" ng-show="storageuser">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/notifications">
<i class="icon ion-android-notifications-none"></i> {{'Notifications' | translate }} <i class="icon ion-android-notifications-none"></i> {{'Notifications' | translate }}
<span class="badge badge-positive">{{userdata.notifications.length}}</span> <span class="badge badge-positive">{{userdata.notifications.length}}</span>
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/settings">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/settings">
<i class="icon ion-settings"></i> {{'Settings' | translate }} <i class="icon ion-settings"></i> {{'Settings' | translate }}
</a> </a>
<a class="item item-icon-left" menu-close href="#/app/help">
<a class="item item-icon-left o_bSidenav" menu-close href="#/app/help">
<i class="icon ion-ios-help-outline"></i> {{'Help' | translate }} <i class="icon ion-ios-help-outline"></i> {{'Help' | translate }}
</a> </a>
<a class="item item-icon-left" menu-close ng-click="logout()" ng-show="storageuser">
<i class="icon ion-home"></i> {{'Logout' | translate }}
<a class="item item-icon-left o_bSidenav" menu-close ng-click="logout()">
<i class="icon ion-power"></i> {{'Logout' | translate }}
</a> </a>
</ion-list> </ion-list>
</ion-content> </ion-content>

+ 3
- 6
www/templates/offerCar.html

@ -1,6 +1,6 @@
<ion-view view-title="Offer Car"> <ion-view view-title="Offer Car">
<ion-content> <ion-content>
<form class="list">
<div class="list">
<label class="item item-input"> <label class="item item-input">
<span class="input-label"t>{{'Title' | translate}}</span> <span class="input-label"t>{{'Title' | translate}}</span>
<input ng-model="newtravel.title" class="positive" type="text" placeholder=""> <input ng-model="newtravel.title" class="positive" type="text" placeholder="">
@ -50,13 +50,10 @@
<input ng-model="newtravel.description" type="text" placeholder="Description"> <input ng-model="newtravel.description" type="text" placeholder="Description">
</label> </label>
<p class="padding"> <p class="padding">
<button ng-click="closeNewOfferingTravel()" class="button button-assertive">
{{'Cancel' | translate}}
</button>
<button ng-click="doNewOfferingTravel()" class="button button-calm">
<button ng-click="createTravel()" class="button button-calm o_floatRight">
{{'Create_travel' | translate}} {{'Create_travel' | translate}}
</button> </button>
</p> </p>
</form>
</div>
</ion-content> </ion-content>
</ion-view> </ion-view>

+ 1
- 1
www/templates/signup.html

@ -18,7 +18,7 @@
</label> </label>
<label class="item item-input"> <label class="item item-input">
<span class="input-label">{{'Mail' | translate }}*</span> <span class="input-label">{{'Mail' | translate }}*</span>
<input type="email" ng-model="signupData.mail">
<input type="email" ng-model="signupData.email">
</label> </label>
<label class="item item-input"> <label class="item item-input">
<span class="input-label">{{'Phone' | translate }}</span> <span class="input-label">{{'Phone' | translate }}</span>

+ 1
- 1
www/templates/travels.html

@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<a ng-repeat="travel in travels | orderBy: 'date' | filter: search" class="item item-avatar" href="#/app/travels/{{travel._id}}"> <a ng-repeat="travel in travels | orderBy: 'date' | filter: search" class="item item-avatar" href="#/app/travels/{{travel._id}}">
<img ng-src="img/{{travel.modality}}.png"/>
<img ng-src="img/{{travel.type}}.png"/>
<h2>{{travel.title}}</h2> <h2>{{travel.title}}</h2>
<div class="item-note text-right"> <div class="item-note text-right">
<div class="positive">{{travel.date | date:"dd/MM"}}</div> <div class="positive">{{travel.date | date:"dd/MM"}}</div>

+ 6
- 6
www/templates/user.html

@ -1,13 +1,13 @@
<ion-view view-title="{{'User' | translate}} {{user.username}}"> <ion-view view-title="{{'User' | translate}} {{user.username}}">
<ion-content> <ion-content>
<div class="item item-avatar"> <div class="item item-avatar">
<img ng-src="img/avatars/{{user.avatar}}.png" />
<img ng-src="{{user.avatar}}" />
<h2>{{user.username}}</h2> <h2>{{user.username}}</h2>
</div> </div>
<div class="item item-body"> <div class="item item-body">
<p class="o-bold">{{user.description}}</p> <p class="o-bold">{{user.description}}</p>
<p>{{user.mail}}</p> <p>{{user.mail}}</p>
<p>
<p ng-show="user.telegram">
<!--<a ng-href="https://telegram.me/{{user.telegram}}" target="_blank" class="button">--> <!--<a ng-href="https://telegram.me/{{user.telegram}}" target="_blank" class="button">-->
<img class='o-imgMenu' src="img/telegram.png" /> @{{user.telegram}} <img class='o-imgMenu' src="img/telegram.png" /> @{{user.telegram}}
<!--</a>--> <!--</a>-->
@ -34,13 +34,13 @@
</div> </div>
<div class="item item-body"> <div class="item item-body">
{{'current_publications_of' | translate}} {{user.username}}: {{'current_publications_of' | translate}} {{user.username}}:
<div class="positive">{{travels.length}} {{'publications' | translate}}</div>
<div class="positive">{{user.travels.length}} {{'publications' | translate}}</div>
<a ng-repeat="travel in travels | orderBy: 'date'" class="item item-avatar" href="#/app/travels/{{travel._id}}">
<img ng-src="img/{{travel.modality}}.png">
<a ng-repeat="travel in user.travels | orderBy: 'date'" class="item item-avatar" href="#/app/travels/{{travel._id}}">
<img ng-src="img/{{travel.type}}.png">
<h2>{{travel.title}} <h2>{{travel.title}}
<div class="item-note"> <div class="item-note">
<div class="positive">{{travel.date | date:"dd/MM HH:mm a"}}</div>
<div class="positive">{{travel.date | date:"dd/MM/yyyy HH:mm a"}}</div>
</div> </div>
</h2> </h2>

+ 1
- 1
www/templates/users.html

@ -13,7 +13,7 @@
</div> </div>
<a ng-repeat="user in users | orderBy: 'date'" class="item item-avatar" ng-href="#/app/users/{{user.username}}"> <a ng-repeat="user in users | orderBy: 'date'" class="item item-avatar" ng-href="#/app/users/{{user.username}}">
<img ng-src="img/avatars/{{user.avatar}}.png">
<img ng-src="{{user.avatar}}">
<h2>{{user.username}}</h2> <h2>{{user.username}}</h2>
<p> <p>
{{user.description}} {{user.description}}

Loading…
Cancel
Save