diff --git a/templates/js/controllers/myProjectsController.js b/templates/js/controllers/myProjectsController.js index 9ca67a8..1b65c6b 100644 --- a/templates/js/controllers/myProjectsController.js +++ b/templates/js/controllers/myProjectsController.js @@ -1,7 +1,6 @@ angular.module('SeHub') .controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { - $scope.isEditPressed = false; $scope.loadingData = true; $scope.myProjectsEmpty = true; $scope.user = $scope.$parent.user; @@ -52,18 +51,5 @@ angular.module('SeHub') }; $scope.arrayHolder.push(tempArr); } - - $scope.editPressed = function() - { - $scope.isEditPressed = true; - console.log("EditPressed " + $scope.isEditPressed); - } - $scope.removeProject = function() - { - console.log("Project has been removed!"); - } - - $scope.displayMyProjects(); // Will display all my projects - }]); \ No newline at end of file diff --git a/templates/js/controllers/projectController.js b/templates/js/controllers/projectController.js index 6db2fa2..785ad46 100644 --- a/templates/js/controllers/projectController.js +++ b/templates/js/controllers/projectController.js @@ -2,6 +2,46 @@ angular.module('SeHub') .controller('projectController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { + var token = $cookies['com.sehub.www']; + var projectId = $routeParams.projectId; + $scope.isEditPressed = false; + $scope.user = $scope.$parent.user; + $scope.loadingData = true; + // $scope.thisProject = {}; + // $scope.thisProject.courseName = $routeParams.className; + $scope.editProject = function() + { + $scope.isEditPressed = true; + console.log("EditPressed " + $scope.isEditPressed); + } + $scope.removeProject = function() + { + console.log("Project has been removed!"); + } + + $scope.getProjectInfo = function() + { + apiService.getProjectsById(token, projectId).success(function(data) + { + $scope.project = data; + console.log($scope.project); + $scope.init_line_lables(); + $scope.loadingData = false; + console.log($scope.project); + }).error(function(err) + { + console.log("Error: " + err.message); + }); + } + + $scope.init_line_lables = function(){ + $scope.project.weekly_labels = []; + for(var i = 0 ; i < $scope.project.info.stats.weekly_commits[0].length; i++) + $scope.project.weekly_labels.push('w '+i.toString()); + + } + + $scope.getProjectInfo(); // Get all this project data }]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 6420e60..e3352d3 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -125,6 +125,14 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getProjectsById: function(token, projectId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsById/" + token + "/" + projectId; + req = { + method : "GET", + url : url + }; + return $http(req); + }, getProjectsByUser: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/getProjectsByUser/" + token; req = { diff --git a/templates/views/project.html b/templates/views/project.html index 8d4eba2..fd17677 100644 --- a/templates/views/project.html +++ b/templates/views/project.html @@ -1,13 +1,44 @@ -
Are You A Lecturer?
-Are You A Lecturer?
+