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

View file

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