First Step Of Independed Profile. ID oriented. Needs Classes List

This commit is contained in:
Sagi Dayan 2015-06-26 15:13:26 +03:00
parent 1c32ed9e56
commit cc3d65037d
2 changed files with 31 additions and 27 deletions

View file

@ -1,31 +1,33 @@
angular.module('SeHub')
.controller('profileController', ['$scope', '$rootScope', 'dataService', 'apiService',
'$cookies', '$location', '$routeParams',
'$cookies', '$location', '$routeParams',
function($scope, $rootScope, dataService, apiService, $cookies, $location, $routeParams) {
var token = $cookies['com.sehub.www'];
var id = $routeParams.id;
$scope.loadingData = true;
$scope.isInRegisterMode = false;
$scope.title = "Profile " + $routeParams.id;
$scope.title = "Profile";
apiService.getUserByToken(token).success(function(data) {
apiService.getUserById(token, id).success(function(data) {
if (data.message == 'No User Found') {
console.error("No User Found!");
}
$scope.loadingData = false;
$scope.user = data;
console.log(data);
if ($scope.user.isFirstLogin) {
$scope.menuObj = {};
$scope.isInRegisterMode = true;
apiService.getCampusesByUserId(token, id).success(function(data) {
$scope.campuses = data;
console.log(data);
$scope.loadingData = false;
$location.path('/register')
}
}).error(function(err) {
console.error(err);
});
});
$scope.isEditMode = false;
$scope.profileMode = "Edit Profile";
$scope.profileModeIcon = "fa fa-pencil";
@ -68,17 +70,17 @@ angular.module('SeHub')
"campus_avatar": "https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg"
}];
$scope.campuses = [{
'title': 'JCE',
'email_ending': '@post.jce.ac.il',
'master_user_id': 123453433341,
'avatar_url': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg'
}, {
'title': 'Stanford',
'email_ending': '@post.jce.ac.il',
'master_user_id': 123453433341,
'avatar_url': 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR9M4uQgaJP1zyiCGw-dK31hU8buWqeuOi9vTXBd4Y8hQcFTZqA'
}];
// $scope.campuses = [{
// 'title': 'JCE',
// 'email_ending': '@post.jce.ac.il',
// 'master_user_id': 123453433341,
// 'avatar_url': 'https://yt3.ggpht.com/--ZkWxybWGOM/AAAAAAAAAAI/AAAAAAAAAAA/_nAICC_kzzI/s88-c-k-no/photo.jpg'
// }, {
// 'title': 'Stanford',
// 'email_ending': '@post.jce.ac.il',
// 'master_user_id': 123453433341,
// 'avatar_url': 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcR9M4uQgaJP1zyiCGw-dK31hU8buWqeuOi9vTXBd4Y8hQcFTZqA'
// }];
$scope.labels = ['Commits', 'Issues Assigned', 'Messages', 'Open Tasks'];
@ -89,8 +91,8 @@ angular.module('SeHub')
[28, 48, 40, 3]
];
$scope.isUser = function(){
return $scope.user.id.toString() === $routeParams.id;
$scope.isUser = function() {
return $scope.$parent.user.id.toString() /*The Actual User*/ === $routeParams.id /*The Profile User*/;
}
}

View file

@ -1,6 +1,8 @@
<div>
<div class="loader" ng-if="loadingData">
<div class="loader" ng-if="loadingData" layout="row" layout-align="center">
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
<md-content layout-padding>
<md-card layout-padding>
@ -96,7 +98,7 @@
<img alt="{{ person.name }}" ng-src="{{ campus.avatar_url }}" class="md-avatar" />
</div>
<div class="port_spacer">
{{ campus.title }} -
<strong>{{ campus.title }}</strong> {{campus.email_ending}}
</div>
<div class="spacer"></div>
<div>