From f3226e089697e5e63b2d13e00f521454a7b8875a Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Fri, 26 Jun 2015 16:49:46 +0300 Subject: [PATCH 1/9] - work in progress --- .../js/controllers/campusesController.js | 60 +++++++++++--- .../js/controllers/myClassesController.js | 78 ++++++++++++++++++- .../js/controllers/projectsController.js | 37 +++++++++ .../js/controllers/registerController.js | 2 +- templates/js/services/apiService.js | 25 +----- templates/views/campuses.html | 6 +- templates/views/myClasses.html | 19 ++++- templates/views/projects.html | 6 +- templates/views/tasks.html | 8 +- templates/views/thisProject.html | 10 +-- 10 files changed, 199 insertions(+), 52 deletions(-) diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index e1d796b..f7a1033 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -1,17 +1,59 @@ angular.module('SeHub') -.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { +.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) +{ + $scope.threeSizedArray =[]; + var token = $cookies['com.sehub.www']; + + $scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; // TODO REMOVE + - - - - $scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; - console.log($scope.campuses); - - // apiService.getCampusesByUser(token).success(function(data) // Get all the campuses + // apiService.getCampusesByUser().success(function(data) // Get all the campuses // { + // console.log("INSIDE"); // $scope.campuses = data; // }).error(function() { // // TODO // }); + console.log($scope.campuses); -}]); \ No newline at end of file + + var init = function() + { + var i, j, counter = 0; + var newLength = 0; + + if(($scope.campuses.length % 3) === 0) + { + newLength = ($scope.campuses.length / 3); + } + else + { + newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.threeSizedArray.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.threeSizedArray[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.campuses[(3*i) + j] != null) + { + $scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j]; + } + } + } + console.log($scope.threeSizedArray); + } + + init(); // Executing the function to initialize campuses show + + + +}]); diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index e4d69d6..9e68070 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -6,6 +6,7 @@ angular.module('SeHub') $scope.isNewCourse = false; $scope.newClassName = false; $scope.course = {}; + // $scope.globalVar = ''; var token = $cookies['com.sehub.www']; $scope.user.finalDate = ''; $scope.user.startDate = ''; @@ -24,15 +25,51 @@ angular.module('SeHub') $scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs']; + console.log($scope.courses); - - // apiService.getClassesByUser(token).success(function(data) // Get all the campuses + // apiService.getClassesByUser().success(function(data) // Get all the courses // { // $scope.courses = data; // }).error(function() { // // TODO // }); + var init = function() + { + var i, j, counter = 0; + var newLength = 0; + + if(($scope.courses.length % 3) === 0) + { + newLength = ($scope.courses.length / 3); + } + else + { + newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up + } + + $scope.holdArrays.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.holdArrays[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.courses[(3*i) + j] != null) + { + $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; + } + } + } + console.log($scope.holdArrays); + } + + init(); // Executing the function to initialize course display + $scope.chooseCourseClicked = function() { @@ -65,6 +102,8 @@ angular.module('SeHub') } }; + // $scope.globalVar = jsonNewCourse; + console.log("Json here:"); console.log(jsonNewCourse); @@ -89,6 +128,41 @@ angular.module('SeHub') } } + var init = function() + { + var i, j, counter = 0; + var newLength = 0; + + if(($scope.courses.length % 3) === 0) + { + newLength = ($scope.courses.length / 3); + } + else + { + newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.holdArrays.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.holdArrays[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.courses[(3*i) + j] != null) + { + $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; + } + } + } + console.log($scope.holdArrays); + } + }]); \ No newline at end of file diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index 617a7a5..0a68d3b 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -19,5 +19,42 @@ angular.module('SeHub') // // TODO // }); + 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); + } + + init(); // Executing the function to initialize projects display + }]); \ No newline at end of file diff --git a/templates/js/controllers/registerController.js b/templates/js/controllers/registerController.js index 589c5fd..928bca6 100644 --- a/templates/js/controllers/registerController.js +++ b/templates/js/controllers/registerController.js @@ -90,7 +90,7 @@ angular.module('SeHub') }; $scope.createCampus = function(ev) { - $scope.createCampusClicked = true; + $scope.createCampusClicked = !$scope.createCampusClicked; if (!$scope.isLecturer) // "!isLecturer" Means => I Am Lecturer; if i am a lecturer (when pressing -> getting last data value before pressing) { diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index e619186..41ad264 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -44,29 +44,18 @@ service.factory('apiService', ['$http', function($http) { return $http(req); }, getCourseByCampusName: function(token){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseByCampusName/" + token; req = { method : "GET", url : url - }; return $http(req); }, - getAllCourses: function(token){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAll/" + token; - req = { - method : "GET", - url : url - - }; - return $http(req); - }, - getAllMessages: function(token){ + getAllMessages: function(){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getAllMessages/" + token; req = { method : "GET", url : url - }; return $http(req); }, @@ -76,7 +65,6 @@ service.factory('apiService', ['$http', function($http) { method : "POST", url : url, data: payLoad - }; return $http(req); }, @@ -85,7 +73,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); }, @@ -95,25 +82,22 @@ service.factory('apiService', ['$http', function($http) { method : "POST", url : url, data: payLoad - }; return $http(req); }, - getCampusesByUser: function(){ + getCampusesByUser: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token; req = { method : "GET", url : url - }; return $http(req); }, - getClassesByCourse: function(){ // Need to add camusName (ngRoute) ~ sagi //TODO + getClassesByUser: function(){ // Need to add campusName (ngRoute) ~ sagi //TODO var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token; req = { method : "GET", url : url - }; return $http(req); }, @@ -122,7 +106,6 @@ service.factory('apiService', ['$http', function($http) { req = { method : "GET", url : url - }; return $http(req); } diff --git a/templates/views/campuses.html b/templates/views/campuses.html index 8d0ddf8..efc9846 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -3,10 +3,10 @@

My Campuses

-
-
+
+
- + {{campus}} diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index c3f333c..f0de7b5 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -2,11 +2,11 @@

My Classes

- -
-
+ +
+
- + {{course}} @@ -14,6 +14,17 @@
+ + +
diff --git a/templates/views/projects.html b/templates/views/projects.html index f67486e..5391903 100644 --- a/templates/views/projects.html +++ b/templates/views/projects.html @@ -1,8 +1,8 @@

Projects

- -
-
+ +
+
{{project}} diff --git a/templates/views/tasks.html b/templates/views/tasks.html index e90e8c5..02df80d 100644 --- a/templates/views/tasks.html +++ b/templates/views/tasks.html @@ -11,25 +11,25 @@ -

Tab One

+

Commits

Commits...

-

Tab Two

+

Issues

Issues...

-

Tab Three

+

Bugs

Bugs Bugs Bugs..

-

Tab Two

+

WhatEver

Bla Bla Bla..

diff --git a/templates/views/thisProject.html b/templates/views/thisProject.html index 98694f4..7d3292f 100644 --- a/templates/views/thisProject.html +++ b/templates/views/thisProject.html @@ -3,16 +3,16 @@

{{user.name}}'s project

-
+
Project Creator: {{user.name}}
-
+
Edit
-
+
@@ -20,12 +20,12 @@
-
+
Here Will Be Graph - Commits Over Period Of Time
-
+
Here Will Be Graph (by columns) - Commits, Issues, Open Tasks From 91ac400452b3da90c541c01a5345a5956f54a903 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Fri, 26 Jun 2015 16:58:55 +0300 Subject: [PATCH 2/9] Merge branch 'master' of https://github.com/sagidayan/SE-Hub into UI # Conflicts: # templates/js/services/apiService.js --- templates/js/services/apiService.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 6c351e3..56a40c0 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -99,8 +99,6 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getCampusesByUser: function(token){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token; getCampusesByUser: function(token){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/campuses/getCampusesByUser/" + token; req = { From 18ca8df227acbb9619a14958d1025274c95d62b9 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Fri, 26 Jun 2015 21:56:41 +0300 Subject: [PATCH 3/9] - campuses fixed - Work in progress (classes, projects) --- templates/css/theme.css | 32 +++++++++ .../js/controllers/campusesController.js | 26 +++---- .../js/controllers/myClassesController.js | 71 +++++++------------ templates/js/services/apiService.js | 8 +-- templates/views/campuses.html | 11 ++- templates/views/myClasses.html | 24 +++---- templates/views/projects.html | 8 +-- 7 files changed, 93 insertions(+), 87 deletions(-) diff --git a/templates/css/theme.css b/templates/css/theme.css index b697697..ea3f3fe 100644 --- a/templates/css/theme.css +++ b/templates/css/theme.css @@ -151,6 +151,38 @@ body.noscroll /*width: 100%;*/ } +/*.hvr-curl-top-left { + display: inline-block; + vertical-align: middle; + -webkit-transform: translateZ(0); + transform: translateZ(0); + box-shadow: 0 0 1px rgba(0, 0, 0, 0); + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -moz-osx-font-smoothing: grayscale; + position: relative; +}*/ + +/* Grow Rotate */ +/*.campusCard { + display: inline-block; + vertical-align: middle; + -webkit-transform: translateZ(0); + transform: translateZ(0); + box-shadow: 0 0 1px rgba(0, 0, 0, 0); + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -moz-osx-font-smoothing: grayscale; + -webkit-transition-duration: 0.3s; + transition-duration: 0.3s; + -webkit-transition-property: transform; + transition-property: transform; +}*/ +.campusCard:hover, .campusCard:focus, .campusCard:active { + -webkit-transform: rotate(4deg); + transform: rotate(4deg); +} + /*.feedMessages { overflow: scroll; diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index f7a1033..5f782d6 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -3,17 +3,16 @@ angular.module('SeHub') { $scope.threeSizedArray =[]; var token = $cookies['com.sehub.www']; - - $scope.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium']; // TODO REMOVE - - // apiService.getCampusesByUser().success(function(data) // Get all the campuses - // { - // console.log("INSIDE"); - // $scope.campuses = data; - // }).error(function() { - // // TODO - // }); + apiService.getCampusesByUser(token).success(function(data) // Get all the campuses + { + $scope.campuses = data; + console.log("INSIDE " + $scope.campuses); + init(); // Executing the function to initialize campuses display + + }).error(function() { + // TODO + }); console.log($scope.campuses); @@ -49,10 +48,13 @@ angular.module('SeHub') } } } - console.log($scope.threeSizedArray); + console.log($scope.threeSizedArray); // TODO REMOVE } - init(); // Executing the function to initialize campuses show + $scope.goToCampus = function(campusId) // Will pass you to courses by specific campus + { + $location.path('/myClasses/' + campusId.toString()); + } diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index 9e68070..d301be6 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -1,16 +1,16 @@ angular.module('SeHub') -.controller('myClassesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +.controller('myClassesController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { $scope.isStudent = false; $scope.isCourse = false; $scope.isNewCourse = false; $scope.newClassName = false; $scope.course = {}; - // $scope.globalVar = ''; var token = $cookies['com.sehub.www']; $scope.user.finalDate = ''; $scope.user.startDate = ''; $scope.showMyClass = false; + var campusId = $routeParams.campusId; if($scope.user.isLecturer) { @@ -23,58 +23,37 @@ angular.module('SeHub') console.log("Student Mode!"); } - - $scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs']; - console.log($scope.courses); - - // apiService.getClassesByUser().success(function(data) // Get all the courses - // { - // $scope.courses = data; - // }).error(function() { - // // TODO - // }); - - var init = function() + apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display { - var i, j, counter = 0; - var newLength = 0; - - if(($scope.courses.length % 3) === 0) - { - newLength = ($scope.courses.length / 3); - } - else - { - newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up - } + $scope.courses = data; + console.log("success " + $scope.courses); + init(); // Executing the function to initialize course display + }).error(function(err) + { + console.log("error: " + err); + }); - $scope.holdArrays.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.holdArrays[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.courses[(3*i) + j] != null) - { - $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; - } - } - } - console.log($scope.holdArrays); + $scope.goToClass = function(classId) + { + console.log("Done! " + $scope.courses); + $location.path('/projects/' + classId.toString()); // Will display all the projects in this course } - init(); // Executing the function to initialize course display - - $scope.chooseCourseClicked = function() { $scope.isCourse = true; console.log("choose course Clicked!!"); + + apiService.getAllCampuses(token).success(function(data) + { + $scope.campuses = data; + console.log("Campuses: " + $scope.campuses.toString()); + }).error(function(err) + { + console.log("Error: " + err); + }); + + } $scope.createCourseClicked = function() diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 56a40c0..9826c64 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -108,8 +108,8 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getClassesByUser: function(){ // Need to add campusName (ngRoute) ~ sagi //TODO - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token; + getCoursesByUser: function(token, campusId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByUser/" + token + "/" + campusId; req = { method : "GET", url : url @@ -117,8 +117,8 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getProjectsByCourse: function(){ // Need to add courseID (ngRoute) ~ sagi //TODO - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token; + getProjectsByCourse: function(token, classId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token + "/" + classId; req = { method : "GET", url : url diff --git a/templates/views/campuses.html b/templates/views/campuses.html index efc9846..d4e2523 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -1,15 +1,14 @@
-

My Campuses

+

Pick A Campus

- - - {{campus}} - - + + + {{campus.title}} +
diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index f0de7b5..e7ae43d 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -5,26 +5,15 @@
- - -
@@ -40,6 +29,11 @@ + + + + +
diff --git a/templates/views/projects.html b/templates/views/projects.html index 5391903..7cb6349 100644 --- a/templates/views/projects.html +++ b/templates/views/projects.html @@ -3,11 +3,11 @@ From 380228947bf9504fbef39e44099fd25422715536 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 12:45:44 +0300 Subject: [PATCH 4/9] -Bugs fixing - Create class bug - fixed - Work in progress (classes, projects) - need to check API --- .../js/controllers/campusesController.js | 52 ++++--- templates/js/controllers/homeController.js | 23 ++- templates/js/controllers/mainController.js | 2 +- .../js/controllers/myClassesController.js | 127 +++++++++-------- .../js/controllers/newCourseController.js | 2 - .../js/controllers/projectsController.js | 133 +++++++++++++----- templates/js/controllers/tasksController.js | 1 - templates/js/services/apiService.js | 18 ++- templates/views/campuses.html | 21 ++- templates/views/home.html | 62 -------- templates/views/myClasses.html | 68 +++++---- templates/views/projects.html | 7 +- templates/views/tasks.html | 78 +++++----- templates/views/thisProject.html | 35 ++++- 14 files changed, 365 insertions(+), 264 deletions(-) diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index 5f782d6..18a79dd 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -2,6 +2,7 @@ angular.module('SeHub') .controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope) { $scope.threeSizedArray =[]; + $scope.campusesEmpty = false; var token = $cookies['com.sehub.www']; apiService.getCampusesByUser(token).success(function(data) // Get all the campuses @@ -21,32 +22,39 @@ angular.module('SeHub') var i, j, counter = 0; var newLength = 0; - if(($scope.campuses.length % 3) === 0) + if($scope.campuses != null) { - newLength = ($scope.campuses.length / 3); + if(($scope.campuses.length % 3) === 0) + { + newLength = ($scope.campuses.length / 3); + } + else + { + newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.threeSizedArray.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.threeSizedArray[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.campuses[(3*i) + j] != null) + { + $scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j]; + } + } + } } else { - newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up - } - - console.log("length: " + newLength); - $scope.threeSizedArray.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.threeSizedArray[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.campuses[(3*i) + j] != null) - { - $scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j]; - } - } + $scope.campusesEmpty = true; } console.log($scope.threeSizedArray); // TODO REMOVE } diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 4dd0251..5dc7f83 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -13,7 +13,6 @@ angular.module('SeHub') var imagePath = $scope.user.avatar_url; //var campusName = ''; - $scope.course = ''; // $scope.campusName = ''; $scope.phones = [ @@ -51,8 +50,30 @@ angular.module('SeHub') } $scope.postMessageClicked = function() // Posting the message itself { + + if($scope.msg.msgToAdd != null) { + jsonNewMsg = { + 'courseName': 'A', // TODO Should be ===> $scope.course.courseName + 'message': $scope.msg.msgToAdd + }; + + // console.log("J: " + jsonNewMsg.toString() + "msg: " + $scope.msg.msgToAdd); + + // apiService.createMessage(token, jsonNewMsg).success(function(data) + // { + // console.log("create Msg!"); + // }).error(function(err) + // { + // console.log("Error: " + err); + // }); + + /* + 'courseName': 'Advance Math', + 'message': 'The lecture today is canceled' + */ + console.log($scope.msg.msgToAdd); $scope.messages.push({"text": $scope.msg.msgToAdd}); } diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index b9ac448..964b4ec 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -31,7 +31,7 @@ angular.module('SeHub') "title": "Projects", "icon": "fa fa-cube", "style": "", - "route": "/myClasses" + "route": "/projects" }, { "title": "Tasks", "icon": "fa fa-clipboard", diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index d301be6..4d5836d 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -1,5 +1,5 @@ angular.module('SeHub') -.controller('myClassesController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +.controller('myClassesController', ['$scope', '$location', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $location, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { $scope.isStudent = false; $scope.isCourse = false; @@ -10,28 +10,21 @@ angular.module('SeHub') $scope.user.finalDate = ''; $scope.user.startDate = ''; $scope.showMyClass = false; + $scope.coursesEmpty = false; var campusId = $routeParams.campusId; - if($scope.user.isLecturer) + var displayCourses = function() { - $scope.isStudent = false; - console.log("Lecturer Mode!"); + apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display + { + $scope.courses = data; + console.log("success " + $scope.courses); + init(); // Executing the function to initialize course display + }).error(function(err) + { + console.log("error: " + err); + }); } - else - { - $scope.isStudent = true; - console.log("Student Mode!"); - } - - apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display - { - $scope.courses = data; - console.log("success " + $scope.courses); - init(); // Executing the function to initialize course display - }).error(function(err) - { - console.log("error: " + err); - }); $scope.goToClass = function(classId) { @@ -52,8 +45,6 @@ angular.module('SeHub') { console.log("Error: " + err); }); - - } $scope.createCourseClicked = function() @@ -63,7 +54,7 @@ angular.module('SeHub') $scope.submitNewClassClicked = function() { - if($scope.course.courseName != '' && $scope.course.endDate != '' && $scope.course.startDate != '') + if($scope.course.courseName != null && $scope.course.endDate != null && $scope.course.startDate != null) { var jsonNewCourse = { @@ -71,38 +62,35 @@ angular.module('SeHub') 'campusName': $scope.course.campusName, 'startDate': { 'year' : $scope.course.startDate.getFullYear(), - 'day' : $scope.course.startDate.getDate(), - 'month': ($scope.course.startDate.getMonth() + 1) + 'day' : $scope.course.startDate.getDate(), + 'month': $scope.course.startDate.getMonth() + 1 }, 'endDate': { 'year' : $scope.course.endDate.getFullYear(), - 'day' : $scope.course.endDate.getDate(), - 'month': ($scope.course.endDate.getMonth() + 1) + 'day' : $scope.course.endDate.getDate(), + 'month': $scope.course.endDate.getMonth() + 1 } }; - // $scope.globalVar = jsonNewCourse; - - console.log("Json here:"); + console.log("Json here: " + $scope.chosenCampus); console.log(jsonNewCourse); apiService.createCourse(token, jsonNewCourse).success(function(data) { console.log("createCourse API done"); - }).error(function(err) - { - console.log(err); - }); - $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') + $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()) .then(function() { $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO }); // Pop-up alert - + }).error(function(err) + { + console.log(err); + }); } else { - $mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('You have encountered and error in creating the course.') + $mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('Some fields are missing.') .ariaLabel('Email verification alert dialog').ok('Try Again!').targetEvent()); } } @@ -112,36 +100,57 @@ angular.module('SeHub') var i, j, counter = 0; var newLength = 0; - if(($scope.courses.length % 3) === 0) + if($scope.courses != null) { - newLength = ($scope.courses.length / 3); + if(($scope.courses.length % 3) === 0) + { + newLength = ($scope.courses.length / 3); + } + else + { + newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.holdArrays.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.holdArrays[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.courses[(3*i) + j] != null) + { + $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; + } + } + } } else { - newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up + $scope.coursesEmpty = true; } - - console.log("length: " + newLength); - $scope.holdArrays.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.holdArrays[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.courses[(3*i) + j] != null) - { - $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; - } - } - } - console.log($scope.holdArrays); + console.log($scope.holdArrays); } + if($scope.user.isLecturer) + { + $scope.isStudent = false; + console.log("Lecturer Mode!"); + } + else + { + $scope.isStudent = true; + console.log("Student Mode!"); + } + + displayCourses(); // Will display the courses that the user related to // TODO!! + + }]); \ No newline at end of file diff --git a/templates/js/controllers/newCourseController.js b/templates/js/controllers/newCourseController.js index f66f396..3eccaea 100644 --- a/templates/js/controllers/newCourseController.js +++ b/templates/js/controllers/newCourseController.js @@ -1,10 +1,8 @@ angular.module('SeHub') .controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { - $scope.goBack = function() { $window.location.href = 'templates/views/myClasses.html'; } - }]); \ No newline at end of file diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index 0a68d3b..a83fd6b 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -1,60 +1,121 @@ angular.module('SeHub') -.controller('projectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +.controller('projectsController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { - console.log("in projects controller"); + var token = $cookies['com.sehub.www']; + var classId = $routeParams.id; + $scope.projectEmpty = false; + + + + $scope.displayProjects = function() + { + console.log("in displayProjecs!!! "); + apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses + { + $scope.projects = data; + init(); // Executing the function to initialize projects display + console.log("project created! not rly!! " + classId); + }).error(function(err) + { + console.log("Error: " + err); + }); + } + + + + $scope.displayProjects(); // Displaying all projects related to user $scope.createProjectClicked = function() { - console.log("project created! not rly!! "); + console.log("project created! not rly!! " + classId); // $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page - } - $scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs']; + // $scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs']; - // apiService.getProjectsByCourse(courseId).success(function(data) // Get all the campuses - // { - // $scope.projects = data; - // }).error(function() { - // // TODO - // }); + $scope.goToProject = 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) + + if($scope.projects != null) { - newLength = ($scope.projects.length / 3); + 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); } else { - newLength = (Math.ceil($scope.projects.length / 3)); // Rounds number up + $scope.projectEmpty = true; } - - 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); } - init(); // Executing the function to initialize projects display + + + + /* + var jsonNewCourse = + { + 'courseName': $scope.course.courseName, + 'campusName': $scope.course.campusName, + 'startDate': { + 'year' : $scope.course.startDate.getFullYear(), + 'day' : $scope.course.startDate.getDate(), + 'month': $scope.course.startDate.getMonth() + 1 + }, + 'endDate': { + 'year' : $scope.course.endDate.getFullYear(), + 'day' : $scope.course.endDate.getDate(), + 'month': $scope.course.endDate.getMonth() + 1 + } + };*/ + + /* + { + 'projectName': 'Advance Math', + 'courseName': 'JCE', + 'grade': 98, + 'logo_url': 'http://location.domain.com/image.jpg', + 'gitRepository': 'http://location.git.com/somthing', + 'membersId': ['bob', 'dylan', 'quentin', 'terentino'], + 'id' : 1234567890 + } + */ + + + + }]); \ No newline at end of file diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js index 705ddb2..33196f4 100644 --- a/templates/js/controllers/tasksController.js +++ b/templates/js/controllers/tasksController.js @@ -8,7 +8,6 @@ angular.module('SeHub') var taskName = name; console.log("task created! " + taskName); $location.path("/tasks/new"); // Reference to 'newTask' page - } diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 9826c64..5c636aa 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -95,7 +95,6 @@ service.factory('apiService', ['$http', function($http) { method : "POST", url : url, data: payLoad - }; return $http(req); }, @@ -142,6 +141,23 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); + }, + joinCourse: function(token, courseId){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + courseId; + req = { + method : "PUT", + url : url + }; + return $http(req); + }, + createMessage: function(token, payLoad){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token; + req = { + method : "POST", + url : url, + data: payLoad + }; + return $http(req); } }; }]); \ No newline at end of file diff --git a/templates/views/campuses.html b/templates/views/campuses.html index d4e2523..66d3654 100644 --- a/templates/views/campuses.html +++ b/templates/views/campuses.html @@ -2,14 +2,21 @@

Pick A Campus

- -
-
- - - {{campus.title}} - + +
+
+
+ + + {{campus.title}} + +
+
> + + You Are Not Related To Any Course, You Can Join A Course By Press 'Join'. + +
\ No newline at end of file diff --git a/templates/views/home.html b/templates/views/home.html index dcce1b2..bec06f6 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -112,68 +112,6 @@
- - -

- Project Evaluation -

- - - -
diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index e7ae43d..637e792 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -5,15 +5,19 @@
- +
+ aaa {{course.id}} - +
+
+ You Are Not Related To Any Course, You May Join Any Course You Wish. +
- +
@@ -21,38 +25,32 @@
- - - -
-
- - - - - - - - - -
-
- - - - - - - - - - - - -
-
-
-
+ + +
+ + + + {{c.title}} + + +
+
+ + + + + + + + + + + + +
+
+
Submit New Class
diff --git a/templates/views/projects.html b/templates/views/projects.html index 7cb6349..dd163fd 100644 --- a/templates/views/projects.html +++ b/templates/views/projects.html @@ -3,11 +3,14 @@
- +
{{project.id}} - +
+
+
+ You Are Not Related To Any Course, You May Join Any Course You Wish.
diff --git a/templates/views/tasks.html b/templates/views/tasks.html index 02df80d..d38e8b4 100644 --- a/templates/views/tasks.html +++ b/templates/views/tasks.html @@ -3,40 +3,50 @@

Tasks

Create Task -
- -
- - - - - -

Commits

-

Commits...

-
-
- - -

Issues

-

Issues...

-
-
- - -

Bugs

-

Bugs Bugs Bugs..

-
-
- - -

WhatEver

-

Bla Bla Bla..

-
-
-
-
- -
+ +
+ + + + + +

Submitted

+

Submitted...

+
+
+ + +

Delayed

+

Delayed...

+
+
+ + +

Not Submitted

+

Not Submitted ..

+
+
+ + +

WhatEver

+

Bla Bla Bla..

+
+
+
+
+
+
+ +
+
+ + + {{project.title}} + +
+
+ +
\ No newline at end of file diff --git a/templates/views/thisProject.html b/templates/views/thisProject.html index 7d3292f..c42991f 100644 --- a/templates/views/thisProject.html +++ b/templates/views/thisProject.html @@ -13,7 +13,8 @@ Edit
- + Remove +
@@ -31,6 +32,38 @@
+
+ + + + + +

Commits

+

Commits...

+
+
+ + +

Issues

+

Issues...

+
+
+ + +

Bugs

+

Bugs Bugs Bugs..

+
+
+ + +

WhatEver

+

Bla Bla Bla..

+
+
+
+
+
+
\ No newline at end of file From c64b865f3ddac633da6f19eba5cdd261d2e54d77 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 12:48:11 +0300 Subject: [PATCH 5/9] - Fixed reference in thisProject/:projectId --- templates/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/js/app.js b/templates/js/app.js index bb9af14..d9b650a 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -66,7 +66,7 @@ app.config(['$routeProvider', '$locationProvider', templateUrl: 'templates/views/campuses.html', controller: 'campusesController' }) - .when('/thisProject', { + .when('/thisProject/:projectId', { templateUrl: 'templates/views/thisProject.html', controller: 'thisProjectController' }); From b630f0d69648233ad18d9bc9d96cf2fece1a3684 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 12:58:04 +0300 Subject: [PATCH 6/9] - Main menu nav - Project reference fixed --- templates/js/controllers/mainController.js | 2 +- .../js/controllers/projectsController.js | 61 +++++++++---------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index 964b4ec..135b39c 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -31,7 +31,7 @@ angular.module('SeHub') "title": "Projects", "icon": "fa fa-cube", "style": "", - "route": "/projects" + "route": "/projects/" + $scope.user.id.toString() }, { "title": "Tasks", "icon": "fa fa-clipboard", diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index a83fd6b..a2c835f 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -5,8 +5,6 @@ angular.module('SeHub') var classId = $routeParams.id; $scope.projectEmpty = false; - - $scope.displayProjects = function() { console.log("in displayProjecs!!! "); @@ -19,6 +17,10 @@ angular.module('SeHub') { console.log("Error: " + err); }); + if($scope.projects = null) + { + $scope.projectEmpty = true; + } } @@ -43,42 +45,35 @@ angular.module('SeHub') { var i, j, counter = 0; var newLength = 0; - - if($scope.projects != null) + + if(($scope.projects.length % 3) === 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); + newLength = ($scope.projects.length / 3); } else { - $scope.projectEmpty = true; + 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); } From eb1240f3c459cfa8e8cbdcefa3c37c8b4e9a9a68 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 14:20:21 +0300 Subject: [PATCH 7/9] - Main menu nav - My Projects reference fixed to user projects - Main menu nav - click on Courses -> Campuses -> Courses -> Projects (all class users) - API function getProjectsByUser - Added --- templates/js/app.js | 4 +- .../js/controllers/campusesController.js | 83 ++++++++++--------- templates/js/controllers/mainController.js | 4 +- .../js/controllers/myClassesController.js | 59 +++++++------ .../js/controllers/projectsController.js | 2 - .../js/controllers/thisProjectController.js | 16 ---- templates/js/services/apiService.js | 10 +++ templates/views/index.html | 2 +- templates/views/myClasses.html | 1 - templates/views/thisProject.html | 69 --------------- 10 files changed, 85 insertions(+), 165 deletions(-) delete mode 100644 templates/js/controllers/thisProjectController.js delete mode 100644 templates/views/thisProject.html diff --git a/templates/js/app.js b/templates/js/app.js index d9b650a..87c3eaa 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -66,8 +66,8 @@ app.config(['$routeProvider', '$locationProvider', templateUrl: 'templates/views/campuses.html', controller: 'campusesController' }) - .when('/thisProject/:projectId', { - templateUrl: 'templates/views/thisProject.html', + .when('/myProjects', { + templateUrl: 'templates/views/myProjects.html', controller: 'thisProjectController' }); } diff --git a/templates/js/controllers/campusesController.js b/templates/js/controllers/campusesController.js index 18a79dd..ead0ef2 100644 --- a/templates/js/controllers/campusesController.js +++ b/templates/js/controllers/campusesController.js @@ -5,56 +5,37 @@ angular.module('SeHub') $scope.campusesEmpty = false; var token = $cookies['com.sehub.www']; - apiService.getCampusesByUser(token).success(function(data) // Get all the campuses - { - $scope.campuses = data; - console.log("INSIDE " + $scope.campuses); - init(); // Executing the function to initialize campuses display - - }).error(function() { - // TODO - }); - console.log($scope.campuses); - - var init = function() { var i, j, counter = 0; var newLength = 0; - if($scope.campuses != null) + if(($scope.campuses.length % 3) === 0) { - if(($scope.campuses.length % 3) === 0) - { - newLength = ($scope.campuses.length / 3); - } - else - { - newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up - } - - console.log("length: " + newLength); - $scope.threeSizedArray.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.threeSizedArray[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.campuses[(3*i) + j] != null) - { - $scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j]; - } - } - } + newLength = ($scope.campuses.length / 3); } else { - $scope.campusesEmpty = true; + newLength = (Math.ceil($scope.campuses.length / 3)); // Rounds number up + } + + console.log("length: " + newLength); + $scope.threeSizedArray.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.threeSizedArray[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.campuses[(3*i) + j] != null) + { + $scope.threeSizedArray[i][j] = $scope.campuses[(3*i) + j]; + } + } } console.log($scope.threeSizedArray); // TODO REMOVE } @@ -64,6 +45,26 @@ angular.module('SeHub') $location.path('/myClasses/' + campusId.toString()); } + $scope.displayCampuses = function() + { + apiService.getCampusesByUser(token).success(function(data) // Get all the campuses + { + $scope.campuses = data; + console.log("INSIDE " + $scope.campuses); + init(); // Executing the function to initialize campuses display + + }).error(function() + { + // TODO + }); + if($scope.campuses != null) + { + $scope.campusesEmpty = true; + } + } + + $scope.displayCampuses(); // Displaying all campuses by user + }]); diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index 135b39c..fe0a671 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -28,10 +28,10 @@ angular.module('SeHub') "style": "", "route": "/campuses" }, { - "title": "Projects", + "title": "My Projects", "icon": "fa fa-cube", "style": "", - "route": "/projects/" + $scope.user.id.toString() + "route": "/myProjects" }, { "title": "Tasks", "icon": "fa fa-clipboard", diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index 4d5836d..e1f7fa1 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -24,6 +24,10 @@ angular.module('SeHub') { console.log("error: " + err); }); + if($scope.courses = null) + { + $scope.coursesEmpty = true; + } } $scope.goToClass = function(classId) @@ -99,42 +103,35 @@ angular.module('SeHub') { var i, j, counter = 0; var newLength = 0; - - if($scope.courses != null) + + if(($scope.courses.length % 3) === 0) { - if(($scope.courses.length % 3) === 0) - { - newLength = ($scope.courses.length / 3); - } - else - { - newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up - } - - console.log("length: " + newLength); - $scope.holdArrays.length = newLength; - - for(j = 0; j < newLength; j++) - { - $scope.holdArrays[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.courses[(3*i) + j] != null) - { - $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; - } - } - } + newLength = ($scope.courses.length / 3); } else { - $scope.coursesEmpty = true; + newLength = (Math.ceil($scope.courses.length / 3)); // Rounds number up } - console.log($scope.holdArrays); + + console.log("length: " + newLength); + $scope.holdArrays.length = newLength; + + for(j = 0; j < newLength; j++) + { + $scope.holdArrays[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.courses[(3*i) + j] != null) + { + $scope.holdArrays[i][j] = $scope.courses[(3*i) + j]; + } + } + } + console.log($scope.holdArrays); } diff --git a/templates/js/controllers/projectsController.js b/templates/js/controllers/projectsController.js index a2c835f..0bd6b99 100644 --- a/templates/js/controllers/projectsController.js +++ b/templates/js/controllers/projectsController.js @@ -23,8 +23,6 @@ angular.module('SeHub') } } - - $scope.displayProjects(); // Displaying all projects related to user $scope.createProjectClicked = function() diff --git a/templates/js/controllers/thisProjectController.js b/templates/js/controllers/thisProjectController.js deleted file mode 100644 index a1cb837..0000000 --- a/templates/js/controllers/thisProjectController.js +++ /dev/null @@ -1,16 +0,0 @@ -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.editPressed = function() - { - $scope.isEditPressed = true; - console.log("EditPressed " + $scope.isEditPressed); - } - $scope.removeProject = function() - { - console.log("Project has been removed!"); - } - -}]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 5c636aa..8d14f27 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -125,6 +125,16 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, + getProjectsByUser: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token; + req = { + method : "GET", + url : url + + }; + return $http(req); + }, + getUserById: function(token, id){ var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + id; req = { diff --git a/templates/views/index.html b/templates/views/index.html index f719a34..56f7232 100644 --- a/templates/views/index.html +++ b/templates/views/index.html @@ -117,7 +117,7 @@ - + \ No newline at end of file diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index 637e792..d316c25 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -6,7 +6,6 @@
- aaa {{course.id}} diff --git a/templates/views/thisProject.html b/templates/views/thisProject.html deleted file mode 100644 index c42991f..0000000 --- a/templates/views/thisProject.html +++ /dev/null @@ -1,69 +0,0 @@ -
- -

{{user.name}}'s project

-
-
-
- Project Creator: {{user.name}} -
-
-
-
-
- Edit -
-
- Remove - -
-
-
-
-
-
-
- - Here Will Be Graph - Commits Over Period Of Time - -
-
- - Here Will Be Graph (by columns) - Commits, Issues, Open Tasks - -
-
-
- - - - - -

Commits

-

Commits...

-
-
- - -

Issues

-

Issues...

-
-
- - -

Bugs

-

Bugs Bugs Bugs..

-
-
- - -

WhatEver

-

Bla Bla Bla..

-
-
-
-
-
-
-
-
-
\ No newline at end of file From 191924a732573e267ce41ce30b793a25e7da028e Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 14:36:20 +0300 Subject: [PATCH 8/9] - work in progress (creating course - reference) --- templates/views/newCourse.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/views/newCourse.html b/templates/views/newCourse.html index 03b9c60..dd28d8b 100644 --- a/templates/views/newCourse.html +++ b/templates/views/newCourse.html @@ -1,6 +1,6 @@
-

My New Course

+

{{user.name}}'s' New Course

Go Back
\ No newline at end of file From 163a711f0fc9e3b65e7bbe7331a7c4671ca2cc73 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Sat, 27 Jun 2015 14:52:49 +0300 Subject: [PATCH 9/9] - Create Class reference - fixed --- templates/js/controllers/myClassesController.js | 5 +++-- templates/js/controllers/newCourseController.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index e1f7fa1..ccabe30 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -1,5 +1,6 @@ angular.module('SeHub') -.controller('myClassesController', ['$scope', '$location', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $location, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +.controller('myClassesController', ['$scope', '$location', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', + function ($scope, $location, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { $scope.isStudent = false; $scope.isCourse = false; @@ -85,7 +86,7 @@ angular.module('SeHub') $mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.') .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent()) .then(function() { - $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO + $location.path('/newCourse'); // TODO TODO TODO }); // Pop-up alert }).error(function(err) { diff --git a/templates/js/controllers/newCourseController.js b/templates/js/controllers/newCourseController.js index 3eccaea..f330cdf 100644 --- a/templates/js/controllers/newCourseController.js +++ b/templates/js/controllers/newCourseController.js @@ -1,8 +1,9 @@ angular.module('SeHub') -.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) +.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', + function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { $scope.goBack = function() { - $window.location.href = 'templates/views/myClasses.html'; + $location.path('/myClasses'); } }]); \ No newline at end of file