- goldMINE!!!

-location reference fixed
This commit is contained in:
Matan Bar Yosef 2015-06-29 21:01:30 +03:00
parent 23e8780dd6
commit ab35e946c0
4 changed files with 12 additions and 12 deletions

View file

@ -54,7 +54,7 @@ app.config(['$routeProvider', '$locationProvider',
templateUrl: 'templates/views/newTask.html', templateUrl: 'templates/views/newTask.html',
controller: 'newTasksController' controller: 'newTasksController'
}) })
.when('/class/:projectId', { .when('/class/:classId/:className', {
templateUrl: 'templates/views/class.html', templateUrl: 'templates/views/class.html',
controller: 'classController' controller: 'classController'
}) })

View file

@ -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) .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 token = $cookies['com.sehub.www'];
var classId = $routeParams.projectId; var classId = $routeParams.classId;
// var projectId = ""; $scope.project = {};
$scope.project.courseName = $routeParams.className;
$scope.projectsEmpty = true; $scope.projectsEmpty = true;
$scope.isCreateProjectClicked = false; $scope.isCreateProjectClicked = false;
$scope.submitNewCourseClicked = false; $scope.submitNewCourseClicked = false;
$scope.project = {};
$scope.loadingData = true; $scope.loadingData = true;
$scope.isInCourse = false; $scope.isInCourse = false;
$scope.project.courseName = classId;
$scope.displayProjects = function() $scope.displayProjects = function()
{ {
console.log("in displayProjecs!!! ");
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
{ {
$scope.loadingData = false; $scope.loadingData = false;

View file

@ -15,10 +15,10 @@ angular.module('SeHub')
$scope.campusId; $scope.campusId;
var campusId = $routeParams.campusId; var campusId = $routeParams.campusId;
$scope.goToClass = function(classId) $scope.goToClass = function(classId, className)
{ {
console.log("Done! " + $scope.courses); console.log("Done! " + className);
$location.path('/class/' + classId.toString()); // Will display all the projects in this course $location.path('/class/' + classId.toString() + '/' + className); // Will display all the projects in this course
} }
$scope.chooseCampusClicked = function() $scope.chooseCampusClicked = function()
@ -82,7 +82,8 @@ angular.module('SeHub')
$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()) .ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() { .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 }); // Pop-up alert
}).error(function(err) }).error(function(err)
{ {

View file

@ -7,7 +7,7 @@
<div flex = "32" layout = "column" ng-repeat = "course in t" value = "{{course}}" > <div flex = "32" layout = "column" ng-repeat = "course in t" value = "{{course}}" >
<div ng-if = "!scope.coursesEmpty"> <div ng-if = "!scope.coursesEmpty">
<div ng-if="t.length != 1"> <div ng-if="t.length != 1">
<md-button ng-click = "goToClass(course.id)" style="width:100%; height:32%;" layout-padding class = "md-raised" > <md-button ng-click = "goToClass(course.id, course.courseName)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
<div style="width:97%;height:97%"> <div style="width:97%;height:97%">
<md-card-content> <md-card-content>
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" --> <h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->
@ -16,7 +16,7 @@
</md-button> </md-button>
</div> </div>
<div ng-if="t.length == 1"> <div ng-if="t.length == 1">
<md-button ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" > <md-button ng-click = "goToClass(course.id, course.courseName)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
<div style="width:97%;height:97%"> <div style="width:97%;height:97%">
<md-card-content> <md-card-content>
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" --> <h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->