Profile: Fixed The profile UI and Logic

now there is a message if there is no User.

Only thing left are user stats
This commit is contained in:
Sagi Dayan 2015-06-30 18:48:13 +03:00
parent 493ea04499
commit cc4425b360
3 changed files with 61 additions and 53 deletions

View file

@ -241,6 +241,14 @@ body.noscroll
/*width:80%;*/ /*width:80%;*/
} }
.gray-font-no-animation
{
color: #7f7f7f;
font-size: 300%;
text-shadow:#e0e0e0 1px 1px 0;
}
.gray-font .gray-font
{ {
color: #7f7f7f; color: #7f7f7f;

View file

@ -7,26 +7,33 @@ angular.module('SeHub')
var id = $routeParams.id; var id = $routeParams.id;
$scope.loadingData = true; $scope.loadingData = true;
$scope.isInRegisterMode = false; $scope.isInRegisterMode = false;
$scope.userExists = false;
$scope.title = "Profile"; $scope.title = "Profile";
apiService.getUserById(token, id).success(function(data) { apiService.getUserById(token, id).success(function(data) {
if (data.message == 'No User Found') { if (!data) {
console.error("No User Found!"); console.error("No User Found!");
$scope.loadingData = false;
return;
} }
$scope.user = data; $scope.user = data;
apiService.getCampusesByUserId(token, id).success(function(data) { $scope.userExists = true;
apiService.getCampusesByUserId(token, id)
.success(function(data) {
$scope.campuses = data; $scope.campuses = data;
console.log(data); console.log(data);
apiService.getCoursesByUserID(token, id).success(function(data){ apiService.getCoursesByUserID(token, id)
.success(function(data) {
$scope.courses = data; $scope.courses = data;
}).error(function(err) { }).error(function(err) {
console.error('In apiService.getCoursesByUserID', err); console.error('In apiService.getCoursesByUserID', err);
}) });
$scope.loadingData = false; $scope.loadingData = false;
}).error(function(err) { }).error(function(err) {
console.error(err); console.error(err);
console.error("++++++++++++++++++++");
}); });
}); });
@ -55,39 +62,6 @@ angular.module('SeHub')
} }
} }
/**
* DEBUG DATA
*/
// $scope.courses = [{
// "courseName": "Advance Math",
// "campusName": "JCE",
// "startDate": {
// "year": 2015,
// "month": 4,
// "day": 3
// },
// "endDate": {
// "year": 2016,
// "month": 5,
// "day": 14
// },
// "taskFlag": false,
// "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.labels = ['Commits', 'Issues Assigned', 'Messages', 'Open Tasks']; $scope.labels = ['Commits', 'Issues Assigned', 'Messages', 'Open Tasks'];
//$scope.series = ['Project A', 'Project B']; //$scope.series = ['Project A', 'Project B'];

View file

@ -4,7 +4,7 @@
<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 ng-if="userExists && !loadingData">
<md-card layout-padding> <md-card layout-padding>
<h1><i class="fa fa-cogs"></i> {{title}}</h1> <h1><i class="fa fa-cogs"></i> {{title}}</h1>
<div layout="row"> <div layout="row">
@ -73,7 +73,7 @@
<div class="settingListRoot"> <div class="settingListRoot">
<div ng-repeat="course in courses" class="settingListItem" layout="row"> <div ng-repeat="course in courses" class="settingListItem" layout="row">
<div> <div>
<img alt="{{ person.name }}" ng-src="{{ course.campus_avatar }}" class="md-avatar" /> <img alt="{{ person.name }}" src="https://www.isc2.org/uploadedimages/education/classroom-based-training-icon.png" class="md-avatar" />
</div> </div>
<div class="port_spacer"> <div class="port_spacer">
{{ course.courseName }} - <strong>IN</strong> {{course.campusName}} {{ course.courseName }} - <strong>IN</strong> {{course.campusName}}
@ -115,8 +115,34 @@
<!-- End Campuses & Classes Div --> <!-- End Campuses & Classes Div -->
</div> </div>
</md-card> </md-card>
</md-content>
<md-content layout-padding ng-if="!userExists && !loadingData" class="gray-font-no-animation">
<md-card>
<div layout="row">
<div class="spacer"></div>
<div>
<h1><i class="fa fa-exclamation-triangle"></i></h1>
</div>
<div class="spacer"></div>
</div>
<div layout="row">
<div class="spacer"></div>
<div>
<h1>User Not Found</h1>
</div>
<div class="spacer"></div>
</div>
<div layout="row">
<div class="spacer"></div>
<div>
<P>Might Not Be A Registered SE-Hub User</P>
</div>
<div class="spacer"></div>
</div>
</md-card>
</md-content> </md-content>
</div> </div>