Merge pull request #84 from sagidayan/UI
- create class is working again
This commit is contained in:
commit
02a10aba63
4 changed files with 29 additions and 17 deletions
|
@ -12,6 +12,7 @@ angular.module('SeHub')
|
||||||
$scope.user.startDate = '';
|
$scope.user.startDate = '';
|
||||||
$scope.showMyClass = false;
|
$scope.showMyClass = false;
|
||||||
$scope.coursesEmpty = false;
|
$scope.coursesEmpty = false;
|
||||||
|
$scope.campusId;
|
||||||
var campusId = $routeParams.campusId;
|
var campusId = $routeParams.campusId;
|
||||||
|
|
||||||
$scope.goToClass = function(classId)
|
$scope.goToClass = function(classId)
|
||||||
|
@ -20,15 +21,16 @@ angular.module('SeHub')
|
||||||
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course
|
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.chooseCourseClicked = function()
|
$scope.chooseCampusClicked = function()
|
||||||
{
|
{
|
||||||
$scope.isCourse = true;
|
$scope.isCourse = true;
|
||||||
console.log("choose course Clicked!!");
|
console.log("Choose campus Clicked!!");
|
||||||
|
|
||||||
apiService.getAllCampuses(token).success(function(data)
|
apiService.getAllCampuses(token).success(function(data)
|
||||||
{
|
{
|
||||||
$scope.campuses = data;
|
$scope.campuses = data;
|
||||||
console.log("Campuses: " + $scope.campuses.toString());
|
console.log("Campuses: ");
|
||||||
|
console.log($scope.campuses);
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err);
|
console.log("Error: " + err);
|
||||||
|
@ -42,12 +44,23 @@ angular.module('SeHub')
|
||||||
|
|
||||||
$scope.submitNewClassClicked = function()
|
$scope.submitNewClassClicked = function()
|
||||||
{
|
{
|
||||||
|
var i;
|
||||||
if($scope.course.courseName != null && $scope.course.endDate != null && $scope.course.startDate != null)
|
if($scope.course.courseName != null && $scope.course.endDate != null && $scope.course.startDate != null)
|
||||||
{
|
{
|
||||||
|
for(i = 0; i < $scope.campuses.length; i++)
|
||||||
|
{
|
||||||
|
if($scope.course.campusName === $scope.campuses[i].title)
|
||||||
|
{
|
||||||
|
$scope.campusId = $scope.campuses[i].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("NOW: ");
|
||||||
|
console.log($scope.campusId);
|
||||||
|
|
||||||
var jsonNewCourse =
|
var jsonNewCourse =
|
||||||
{
|
{
|
||||||
'courseName': $scope.course.courseName,
|
'courseName': $scope.course.courseName,
|
||||||
'campusName': $scope.course.campusName,
|
'campusId': $scope.campusId,
|
||||||
'startDate': {
|
'startDate': {
|
||||||
'year' : $scope.course.startDate.getFullYear(),
|
'year' : $scope.course.startDate.getFullYear(),
|
||||||
'day' : $scope.course.startDate.getDate(),
|
'day' : $scope.course.startDate.getDate(),
|
||||||
|
@ -108,7 +121,7 @@ angular.module('SeHub')
|
||||||
|
|
||||||
var displayCourses = function()
|
var displayCourses = function()
|
||||||
{
|
{
|
||||||
apiService.getCourseByCampusName(token).success(function(data) // Shows all classes from this campus
|
apiService.getCoursesByCampus(campusId).success(function(data) // Shows all classes from this campus
|
||||||
{
|
{
|
||||||
$scope.courses = data;
|
$scope.courses = data;
|
||||||
console.log("success " + $scope.courses);
|
console.log("success " + $scope.courses);
|
||||||
|
|
|
@ -28,9 +28,9 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
|
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
|
||||||
{
|
{
|
||||||
$scope.campuses = data;
|
$scope.campuses = data;
|
||||||
}).error(function() {
|
}).error(function() {
|
||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,8 +43,8 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
};
|
};
|
||||||
return $http(req);
|
return $http(req);
|
||||||
},
|
},
|
||||||
getCourseByCampusName: function(token){
|
getCoursesByCampus: function(campusId){
|
||||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseByCampusName/" + token;
|
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesByCampus/" + campusId;
|
||||||
req = {
|
req = {
|
||||||
method : "GET",
|
method : "GET",
|
||||||
url : url
|
url : url
|
||||||
|
|
|
@ -3,31 +3,30 @@
|
||||||
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
|
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
|
||||||
</md-content>
|
</md-content>
|
||||||
<md-card class="cardAllcourses">
|
<md-card class="cardAllcourses">
|
||||||
|
|
||||||
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding>
|
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding>
|
||||||
<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)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
|
||||||
<md-card style="width:97%;height:97%">
|
<md-card style="width:97%;height:97%">
|
||||||
<md-card-content>
|
<md-card-content>
|
||||||
<h2 class="md-title">{{course.title}}</h2> <!-- Should Be "course.title" -->
|
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->
|
||||||
</md-card-content>
|
</md-card-content>
|
||||||
</md-2card>
|
</md-card>
|
||||||
</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)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
|
||||||
<md-card style="width:97%;height:97%">
|
<md-card style="width:97%;height:97%">
|
||||||
<md-card-content>
|
<md-card-content>
|
||||||
<h2 class="md-title">{{course.title}}</h2> <!-- Should Be "course.title" -->
|
<h2 class="md-title">{{course.courseName}}</h2> <!-- Should Be "course.title" -->
|
||||||
</md-card-content>
|
</md-card-content>
|
||||||
</md-card>
|
</md-card>
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<div ng-if = "!scope.coursesEmpty">
|
<div ng-if = "scope.coursesEmpty">
|
||||||
You Are Not Related To Any Course, You May Join Any Course You Wish.
|
You Are Not Related To Any Course, You May Join Any Course You Wish.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +56,7 @@
|
||||||
<md-card layout-padding>
|
<md-card layout-padding>
|
||||||
<div layout layout-sm="column">
|
<div layout layout-sm="column">
|
||||||
<!-- <input ng-model="course.campusName" required> -->
|
<!-- <input ng-model="course.campusName" required> -->
|
||||||
<md-select placeholder = "Campus name" ng-model="course.campusName" ng-click = "chooseCourseClicked()" required>
|
<md-select placeholder = "Campus name" ng-model="course.campusName" ng-click = "chooseCampusClicked()" required>
|
||||||
<md-option ng-repeat="c in campuses" value="{{c.title}}">
|
<md-option ng-repeat="c in campuses" value="{{c.title}}">
|
||||||
{{c.title}}
|
{{c.title}}
|
||||||
</md-option>
|
</md-option>
|
||||||
|
|
Loading…
Reference in a new issue