From cc3d65037df7b9707984f35e166151b14f046c66 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Fri, 26 Jun 2015 15:13:26 +0300 Subject: [PATCH] First Step Of Independed Profile. ID oriented. Needs Classes List --- templates/js/controllers/profileController.js | 52 ++++++++++--------- templates/views/profile.html | 6 ++- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/templates/js/controllers/profileController.js b/templates/js/controllers/profileController.js index 40ce310..8c5f872 100644 --- a/templates/js/controllers/profileController.js +++ b/templates/js/controllers/profileController.js @@ -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*/; } } diff --git a/templates/views/profile.html b/templates/views/profile.html index 2b2a26e..986f1d9 100644 --- a/templates/views/profile.html +++ b/templates/views/profile.html @@ -1,6 +1,8 @@
-
+
+ +
@@ -96,7 +98,7 @@ {{ person.name }}
- {{ campus.title }} - + {{ campus.title }} {{campus.email_ending}}