diff --git a/templates/js/app.js b/templates/js/app.js index 7fcca2e..338d7af 100644 --- a/templates/js/app.js +++ b/templates/js/app.js @@ -54,7 +54,7 @@ app.config(['$routeProvider', '$locationProvider', templateUrl: 'templates/views/newTask.html', controller: 'newTasksController' }) - .when('/class/:projectId', { + .when('/class/:classId/:className', { templateUrl: 'templates/views/class.html', controller: 'classController' }) diff --git a/templates/js/controllers/classController.js b/templates/js/controllers/classController.js index e7e13ae..397890a 100644 --- a/templates/js/controllers/classController.js +++ b/templates/js/controllers/classController.js @@ -2,19 +2,18 @@ angular.module('SeHub') .controller('classController', ['$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 classId = $routeParams.projectId; - // var projectId = ""; + var classId = $routeParams.classId; + $scope.project = {}; + $scope.project.courseName = $routeParams.className; $scope.projectsEmpty = true; $scope.isCreateProjectClicked = false; $scope.submitNewCourseClicked = false; - $scope.project = {}; $scope.loadingData = true; $scope.isInCourse = false; - $scope.project.courseName = classId; + $scope.displayProjects = function() { - console.log("in displayProjecs!!! "); apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses { $scope.loadingData = false; diff --git a/templates/js/controllers/myClassesController.js b/templates/js/controllers/myClassesController.js index 627631f..5ccfd82 100644 --- a/templates/js/controllers/myClassesController.js +++ b/templates/js/controllers/myClassesController.js @@ -15,10 +15,10 @@ angular.module('SeHub') $scope.campusId; var campusId = $routeParams.campusId; - $scope.goToClass = function(classId) + $scope.goToClass = function(classId, className) { - console.log("Done! " + $scope.courses); - $location.path('/class/' + classId.toString()); // Will display all the projects in this course + console.log("Done! " + className); + $location.path('/class/' + classId.toString() + '/' + className); // Will display all the projects in this course } $scope.chooseCampusClicked = function() @@ -82,7 +82,8 @@ 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() { - $location.path('/newCourse'); // TODO TODO TODO + // $location.path('/newCourse'); // TODO TODO TODO + $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course }); // Pop-up alert }).error(function(err) { diff --git a/templates/js/controllers/myProjectsController.js b/templates/js/controllers/myProjectsController.js index c55bf1d..9ca67a8 100644 --- a/templates/js/controllers/myProjectsController.js +++ b/templates/js/controllers/myProjectsController.js @@ -25,19 +25,11 @@ angular.module('SeHub') { console.log("Error: " + err.message); }); - } $scope.goToProject = function(projectId) { - for (var i = 0; i < $scope.myProjects; i++) - { - if($scope.myProjects.id === projectId) - { - console.log("project ID: " + projectId) - $location.path('/project/' + projectId); - } - }; + $location.path('/project/' + projectId); } var init = function() diff --git a/templates/views/myClasses.html b/templates/views/myClasses.html index 9883a0e..869e6e5 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -7,21 +7,21 @@
- - + +

{{course.courseName}}

- +
- - + +

{{course.courseName}}

- +
diff --git a/templates/views/myProjects.html b/templates/views/myProjects.html index 895d0cc..28d2a14 100644 --- a/templates/views/myProjects.html +++ b/templates/views/myProjects.html @@ -13,7 +13,7 @@
-

{{project.projectName}}

+ {{project.projectName}}
@@ -24,7 +24,7 @@ -

{{project.projectName}}

+ {{project.projectName}}