Merge branch 'UI'
This commit is contained in:
commit
9ad25bff88
7 changed files with 48 additions and 52 deletions
|
@ -307,6 +307,7 @@ def getProjectsByUser(token):
|
||||||
arr = []
|
arr = []
|
||||||
for p in user.projects_id_list:
|
for p in user.projects_id_list:
|
||||||
project = Project.get_by_id(int(p))
|
project = Project.get_by_id(int(p))
|
||||||
|
if project is not None:
|
||||||
projDict = dict(json.loads(project.to_JSON()))
|
projDict = dict(json.loads(project.to_JSON()))
|
||||||
arr.append(projDict)
|
arr.append(projDict)
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,17 @@ angular.module('SeHub')
|
||||||
var dayDeltaOfCourse;
|
var dayDeltaOfCourse;
|
||||||
var courseElapseTime;
|
var courseElapseTime;
|
||||||
$scope.isCourseOver = false;
|
$scope.isCourseOver = false;
|
||||||
|
$scope.isInProject = false;
|
||||||
$scope.createSctionStatus = "fa fa-angle-down";
|
$scope.createSctionStatus = "fa fa-angle-down";
|
||||||
|
|
||||||
|
for(var i = 0; i < $scope.user.courses_id_list.length; i++)
|
||||||
|
if($scope.user.courses_id_list[i] === classId)
|
||||||
|
$scope.isInCourse = true;
|
||||||
|
|
||||||
|
for(var i = 0; i < $scope.user.projects_id_list.length; i++)
|
||||||
|
if($scope.user.projects_id_list[i])
|
||||||
|
$scope.isInProject = true;
|
||||||
|
|
||||||
$scope.displayProjects = function() {
|
$scope.displayProjects = function() {
|
||||||
apiService.getCourseById(token, classId)
|
apiService.getCourseById(token, classId)
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
|
@ -36,7 +45,6 @@ angular.module('SeHub')
|
||||||
courseElapseTime = dayDeltaOfCourse;
|
courseElapseTime = dayDeltaOfCourse;
|
||||||
}
|
}
|
||||||
$scope.courseTimePresentege = ((courseElapseTime/dayDeltaOfCourse) * 100).toString();
|
$scope.courseTimePresentege = ((courseElapseTime/dayDeltaOfCourse) * 100).toString();
|
||||||
console.log($scope.courseTimePresentege);
|
|
||||||
|
|
||||||
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
|
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
|
||||||
{
|
{
|
||||||
|
@ -47,11 +55,11 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
init(); // Executing the function to initialize projects display
|
init(); // Executing the function to initialize projects display
|
||||||
}).error(function(err) {
|
}).error(function(err) {
|
||||||
console.error("Error: " + err);
|
console.error(err.message);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.error(function(err) {
|
.error(function(err) {
|
||||||
console.error("Error: " + err);
|
console.error(err.message);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$scope.joinCourse = function() {
|
$scope.joinCourse = function() {
|
||||||
|
@ -60,14 +68,11 @@ angular.module('SeHub')
|
||||||
$mdDialog.show($mdDialog.alert().title('Joined Course').content('You have successfully joined course.')
|
$mdDialog.show($mdDialog.alert().title('Joined Course').content('You have successfully joined course.')
|
||||||
.ariaLabel('Join course alert dialog').ok('Lets Start!').targetEvent())
|
.ariaLabel('Join course alert dialog').ok('Lets Start!').targetEvent())
|
||||||
.then(function() {
|
.then(function() {
|
||||||
$location.path('/class/' + classId); // TODO TODO TODO
|
$location.path('/class/' + classId + '/' + $scope.project.courseName); // TODO TODO TODO
|
||||||
}); // Pop-up alert
|
}); // Pop-up alert
|
||||||
}).error(function(err) {
|
}).error(function(err) {
|
||||||
$mdDialog.show($mdDialog.alert().title('Error Joining Course').content(err.message + '.')
|
$mdDialog.show($mdDialog.alert().title('Error Joining Course').content(err.message + '.')
|
||||||
.ariaLabel('Join course alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert
|
.ariaLabel('Join course alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert
|
||||||
// .then(function() {
|
|
||||||
// // $location.path('/newCourse'); // TODO TODO TODO
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +92,6 @@ angular.module('SeHub')
|
||||||
'courseId': intClassId,
|
'courseId': intClassId,
|
||||||
'gitRepository': $scope.project.repoOwner + '/' + $scope.project.gitRepoName
|
'gitRepository': $scope.project.repoOwner + '/' + $scope.project.gitRepoName
|
||||||
};
|
};
|
||||||
console.log("Look Down");
|
|
||||||
console.log(jsonNewProj);
|
|
||||||
|
|
||||||
if ($scope.project.logoUrl)
|
if ($scope.project.logoUrl)
|
||||||
jsonNewProj.logo_url = $scope.project.logoUrl;
|
jsonNewProj.logo_url = $scope.project.logoUrl;
|
||||||
|
|
||||||
|
@ -115,7 +117,6 @@ angular.module('SeHub')
|
||||||
|
|
||||||
$scope.goToProject = function(projectId)
|
$scope.goToProject = function(projectId)
|
||||||
{
|
{
|
||||||
console.log("projects only from classID: " + projectId)
|
|
||||||
$location.path('/project/' + projectId);
|
$location.path('/project/' + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,8 @@ angular.module('SeHub')
|
||||||
|
|
||||||
apiService.createMessage(token, jsonNewMsg).success(function(data)
|
apiService.createMessage(token, jsonNewMsg).success(function(data)
|
||||||
{
|
{
|
||||||
console.log("create Msg!");
|
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error Below");
|
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -85,7 +83,6 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
apiService.getProjectsByCourse(token, task.courseId).success(function(data)
|
apiService.getProjectsByCourse(token, task.courseId).success(function(data)
|
||||||
{
|
{
|
||||||
// console.log($scope.user);
|
|
||||||
for(var i = 0; i < $scope.user.projects_id_list.length; i++)
|
for(var i = 0; i < $scope.user.projects_id_list.length; i++)
|
||||||
for(var j = 0; j < data.length; j++)
|
for(var j = 0; j < data.length; j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,27 +14,24 @@ angular.module('SeHub')
|
||||||
$scope.showMyClass = false;
|
$scope.showMyClass = false;
|
||||||
$scope.coursesEmpty = true;
|
$scope.coursesEmpty = true;
|
||||||
$scope.campusId;
|
$scope.campusId;
|
||||||
|
$scope.isMemberInCourse = false;
|
||||||
var campusId = $routeParams.campusId;
|
var campusId = $routeParams.campusId;
|
||||||
|
|
||||||
$scope.goToClass = function(classId, className)
|
$scope.goToClass = function(classId, className)
|
||||||
{
|
{
|
||||||
console.log("Done! " + className);
|
|
||||||
$location.path('/class/' + classId.toString() + '/' + className); // 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()
|
||||||
{
|
{
|
||||||
$scope.isCourse = true;
|
$scope.isCourse = true;
|
||||||
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: ");
|
|
||||||
console.log($scope.campuses);
|
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +52,6 @@ angular.module('SeHub')
|
||||||
$scope.campusId = $scope.campuses[i].id;
|
$scope.campusId = $scope.campuses[i].id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("NOW: ");
|
|
||||||
console.log($scope.campusId);
|
|
||||||
|
|
||||||
var jsonNewCourse =
|
var jsonNewCourse =
|
||||||
{
|
{
|
||||||
|
@ -77,11 +72,9 @@ angular.module('SeHub')
|
||||||
|
|
||||||
apiService.createCourse(token, jsonNewCourse).success(function(data)
|
apiService.createCourse(token, jsonNewCourse).success(function(data)
|
||||||
{
|
{
|
||||||
console.log("createCourse API done");
|
|
||||||
$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('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course
|
$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)
|
||||||
|
@ -118,15 +111,12 @@ angular.module('SeHub')
|
||||||
$scope.holdArrays.push(tempArr);
|
$scope.holdArrays.push(tempArr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$scope.courses = ["lala", "aaa", "bbb", "ccc", "rrr"];
|
|
||||||
|
|
||||||
var displayCourses = function()
|
var displayCourses = function()
|
||||||
{
|
{
|
||||||
apiService.getAllCoursesByCampus(token, campusId).success(function(data) // Shows all classes from this campus
|
apiService.getAllCoursesByCampus(token, campusId).success(function(data) // Shows all classes from this campus
|
||||||
{
|
{
|
||||||
$scope.loadingData = false;
|
$scope.loadingData = false;
|
||||||
$scope.courses = data;
|
$scope.courses = data;
|
||||||
console.log("success " + $scope.courses);
|
|
||||||
init(); // Executing the function to initialize course display
|
init(); // Executing the function to initialize course display
|
||||||
if($scope.courses && $scope.courses.length > 0)
|
if($scope.courses && $scope.courses.length > 0)
|
||||||
{
|
{
|
||||||
|
@ -134,24 +124,17 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("error: " + err);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($scope.user.isLecturer)
|
if($scope.user.isLecturer)
|
||||||
{
|
{
|
||||||
$scope.isStudent = false;
|
$scope.isStudent = false;
|
||||||
console.log("Lecturer Mode!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$scope.isStudent = true;
|
$scope.isStudent = true;
|
||||||
console.log("Student Mode!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCourses(); // Will display the courses that the user related to // TODO!!
|
displayCourses(); // Will display the courses that the user related to // TODO!!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -9,6 +9,8 @@ angular.module('SeHub')
|
||||||
$scope.loadingData = true;
|
$scope.loadingData = true;
|
||||||
$scope.isMaster = false;
|
$scope.isMaster = false;
|
||||||
$scope.isMember = false;
|
$scope.isMember = false;
|
||||||
|
$scope.project = [];
|
||||||
|
$scope.isInProject = false;
|
||||||
|
|
||||||
// $scope.thisProject = {};
|
// $scope.thisProject = {};
|
||||||
// $scope.thisProject.courseName = $routeParams.className;
|
// $scope.thisProject.courseName = $routeParams.className;
|
||||||
|
@ -22,7 +24,6 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.joinProject = function(ev)
|
$scope.joinProject = function(ev)
|
||||||
|
@ -57,6 +58,7 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removed successfully.')
|
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removed successfully.')
|
||||||
.ariaLabel('project remove alert dialog').ok('Ok').targetEvent(ev));
|
.ariaLabel('project remove alert dialog').ok('Ok').targetEvent(ev));
|
||||||
|
$location.path('/myProjects');
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason' + err.message)
|
$mdDialog.show($mdDialog.alert().title('Project Removal').content('Project removal failed - reason' + err.message)
|
||||||
|
@ -96,6 +98,19 @@ angular.module('SeHub')
|
||||||
$scope.isMember = true;
|
$scope.isMember = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiService.getProjectsByCourse(token, $scope.project.courseId).success(function(data)
|
||||||
|
{
|
||||||
|
if($scope.user.projects_id_list)
|
||||||
|
for(var i = 0; i < $scope.project.length; i++)
|
||||||
|
if($scope.user.projects_id_list[i].id === data[i].id.toString())
|
||||||
|
$scope.isInProject = true;
|
||||||
|
|
||||||
|
}).error(function(err)
|
||||||
|
{
|
||||||
|
console.log(err.message);
|
||||||
|
});
|
||||||
|
|
||||||
// if($scope.user === $scope.project.info.master_id)
|
// if($scope.user === $scope.project.info.master_id)
|
||||||
// {
|
// {
|
||||||
// $scope.isMasterOrLecturer = true;
|
// $scope.isMasterOrLecturer = true;
|
||||||
|
@ -106,9 +121,8 @@ angular.module('SeHub')
|
||||||
// }
|
// }
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err.message);
|
console.log(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.getProjectInfo(); // Get all this project data
|
$scope.getProjectInfo(); // Get all this project data
|
||||||
}]);
|
}]);
|
|
@ -27,7 +27,7 @@
|
||||||
<md-button ng-click = "joinCourse()" ng class = "md-raised md-primary" ng-disabled="isCourseOver"><i class="fa fa-plus"></i> Join Class</md-button>
|
<md-button ng-click = "joinCourse()" ng class = "md-raised md-primary" ng-disabled="isCourseOver"><i class="fa fa-plus"></i> Join Class</md-button>
|
||||||
</div>
|
</div>
|
||||||
<div layout-margin>
|
<div layout-margin>
|
||||||
<md-content>
|
<md-content ng-if="isInCourse && !isInProject">
|
||||||
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary" ng-disabled="isCourseOver">Create Project <i ng-class="createSctionStatus"></i></md-button>
|
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary" ng-disabled="isCourseOver">Create Project <i ng-class="createSctionStatus"></i></md-button>
|
||||||
</md-content>
|
</md-content>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<div layout = "row" flex = "45">
|
<div layout = "row" flex = "45">
|
||||||
<!-- <div ng-if = "isMasterOrLecturer"> -->
|
<!-- <div ng-if = "isMasterOrLecturer"> -->
|
||||||
<md-card layout = "row">
|
<md-card layout = "row">
|
||||||
<div ng-if="!isMember" layout-padding>
|
<div ng-if="!isMember && !isInProject" layout-padding>
|
||||||
<md-button ng-click="joinProject($event)" ng class = "md-raised md-primary" aria-label="jP">
|
<md-button ng-click="joinProject($event)" ng class = "md-raised md-primary" aria-label="jP">
|
||||||
<i class="fa fa-user-plus"></i>
|
<i class="fa fa-user-plus"></i>
|
||||||
</md-button>
|
</md-button>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<div flex = "10" layout-padding layout-margin border = "1">
|
<div flex = "10" layout-padding layout-margin border = "1">
|
||||||
Team Members:
|
Team Members:
|
||||||
<ul layout-padding>
|
<ul layout-padding>
|
||||||
<div layout = "row">
|
<!-- <div layout = "row"> -->
|
||||||
<li ng-repeat = "member in project.members">
|
<li ng-repeat = "member in project.members">
|
||||||
<div>
|
<div>
|
||||||
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;"> {{member.name}}</a>
|
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;"> {{member.name}}</a>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</md-button>
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div flex = "40">
|
<div flex = "40">
|
||||||
|
|
Loading…
Reference in a new issue