diff --git a/templates/js/controllers/myProjectsController.js b/templates/js/controllers/myProjectsController.js new file mode 100644 index 0000000..941ea67 --- /dev/null +++ b/templates/js/controllers/myProjectsController.js @@ -0,0 +1,81 @@ +angular.module('SeHub') +.controller('thisProjectController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +{ + $scope.isEditPressed = false; + $scope.myProjectsEmpty = false; + var token = $cookies['com.sehub.www']; + + + + + $scope.displayMyProjects = function() + { + apiService.getProjectsByUser(token).success(function(data) + { + console.log("Success " + data); + $scope.myProjects = data; + }).error(function(err) + { + console.log("Error: " + err); + }); + if($scope.myProjects === null) + { + myProjectsEmpty = true; + } + } + + $scope.goToMyProject = function() + { + console.log("projects only from classID: " + classId) + $location.path('/thisProject' + classId); + } + + var init = function() + { + var i, j, counter = 0; + var newLength = 0; + + if(($scope.projects.length % 3) === 0) + { + newLength = ($scope.projects.length / 3); + } + else + { + newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.arrayHolder.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.arrayHolder[j] = [3]; // Creating array in size of 3 in each array cell + } + + for(i = 0; i < newLength; i++) + { + for(j = 0; j < newLength; j++) + { + if($scope.projects[(3*i) + j] != null) + { + $scope.arrayHolder[i][j] = $scope.projects[(3*i) + j]; + } + } + } + console.log($scope.arrayHolder); + } + + $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/views/myProjects.html b/templates/views/myProjects.html new file mode 100644 index 0000000..1632013 --- /dev/null +++ b/templates/views/myProjects.html @@ -0,0 +1,85 @@ +
+ +

{{user.name}}'s projects

+ +
+
+
+ + {{project.id}} + +
+
+
+ You Do Not Have Any Project, You May Create One. +
+
+
+
+
+ + + \ No newline at end of file