From ab35e946c0193a35af8dfa1ecc4a844723642c50 Mon Sep 17 00:00:00 2001 From: Matan Bar Yosef Date: Mon, 29 Jun 2015 21:01:30 +0300 Subject: [PATCH] - goldMINE!!! -location reference fixed --- templates/js/app.js | 2 +- templates/js/controllers/classController.js | 9 ++++----- templates/js/controllers/myClassesController.js | 9 +++++---- templates/views/myClasses.html | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) 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/views/myClasses.html b/templates/views/myClasses.html index fa25a4d..869e6e5 100644 --- a/templates/views/myClasses.html +++ b/templates/views/myClasses.html @@ -7,7 +7,7 @@
- +

{{course.courseName}}

@@ -16,7 +16,7 @@
- +

{{course.courseName}}