Merge branch 'master' of https://github.com/sagidayan/SE-Hub into API_Dev
This commit is contained in:
commit
8912ca07fa
9 changed files with 129 additions and 70 deletions
|
@ -54,9 +54,9 @@ app.config(['$routeProvider', '$locationProvider',
|
||||||
templateUrl: 'templates/views/newTask.html',
|
templateUrl: 'templates/views/newTask.html',
|
||||||
controller: 'newTasksController'
|
controller: 'newTasksController'
|
||||||
})
|
})
|
||||||
.when('/projects/:classId', {
|
.when('/class/:projectId', {
|
||||||
templateUrl: 'templates/views/projects.html',
|
templateUrl: 'templates/views/class.html',
|
||||||
controller: 'projectsController'
|
controller: 'classController'
|
||||||
})
|
})
|
||||||
.when('/newCourse', {
|
.when('/newCourse', {
|
||||||
templateUrl: 'templates/views/newCourse.html',
|
templateUrl: 'templates/views/newCourse.html',
|
||||||
|
@ -66,6 +66,10 @@ app.config(['$routeProvider', '$locationProvider',
|
||||||
templateUrl: 'templates/views/campuses.html',
|
templateUrl: 'templates/views/campuses.html',
|
||||||
controller: 'campusesController'
|
controller: 'campusesController'
|
||||||
})
|
})
|
||||||
|
.when('/project/:projectId', {
|
||||||
|
templateUrl: 'templates/views/project.html',
|
||||||
|
controller: 'projectController'
|
||||||
|
})
|
||||||
.when('/myProjects', {
|
.when('/myProjects', {
|
||||||
templateUrl: 'templates/views/myProjects.html',
|
templateUrl: 'templates/views/myProjects.html',
|
||||||
controller: 'myProjectsController'
|
controller: 'myProjectsController'
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('projectsController', ['$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.classId;
|
var classId = $routeParams.projectId;
|
||||||
|
// var projectId = "";
|
||||||
$scope.projectsEmpty = true;
|
$scope.projectsEmpty = true;
|
||||||
$scope.isCreateProjectClicked = false;
|
$scope.isCreateProjectClicked = false;
|
||||||
$scope.submitNewCourseClicked = false;
|
$scope.submitNewCourseClicked = false;
|
||||||
$scope.project = {};
|
$scope.project = {};
|
||||||
$scope.loadingData = true;
|
$scope.loadingData = true;
|
||||||
$scope.isInCourse = false;
|
$scope.isInCourse = false;
|
||||||
|
$scope.project.courseName = classId;
|
||||||
|
|
||||||
$scope.displayProjects = function()
|
$scope.displayProjects = function()
|
||||||
{
|
{
|
||||||
|
@ -27,7 +29,6 @@ angular.module('SeHub')
|
||||||
{
|
{
|
||||||
console.log("Error: " + err);
|
console.log("Error: " + err);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
$scope.joinCourse = function()
|
$scope.joinCourse = function()
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,7 @@ 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('/projects/' + classId); // TODO TODO TODO
|
$location.path('/class/' + classId); // TODO TODO TODO
|
||||||
}); // Pop-up alert
|
}); // Pop-up alert
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +58,7 @@ angular.module('SeHub')
|
||||||
|
|
||||||
$scope.submitNewProject = function()
|
$scope.submitNewProject = function()
|
||||||
{
|
{
|
||||||
|
loadingData = true;
|
||||||
// debugger;
|
// debugger;
|
||||||
var intClassId = parseInt(classId);
|
var intClassId = parseInt(classId);
|
||||||
// console.log($scope);
|
// console.log($scope);
|
||||||
|
@ -74,11 +76,13 @@ angular.module('SeHub')
|
||||||
|
|
||||||
apiService.create(token, jsonNewProj).success(function(data)
|
apiService.create(token, jsonNewProj).success(function(data)
|
||||||
{
|
{
|
||||||
|
loadingData = false;
|
||||||
|
projectId = data.id;
|
||||||
$mdDialog.show($mdDialog.alert().title('Project Created').content('You have successfully created project.')
|
$mdDialog.show($mdDialog.alert().title('Project Created').content('You have successfully created project.')
|
||||||
.ariaLabel('Project created alert dialog').ok('Great!').targetEvent());
|
.ariaLabel('Project created alert dialog').ok('Great!').targetEvent())
|
||||||
// .then(function() {
|
.then(function() {
|
||||||
// $location.path('/projects/' + classId); // TODO TODO TODO
|
$location.path('/project/' + projectId); // TODO TODO TODO
|
||||||
// }); // Pop-up alert
|
}); // Pop-up alert
|
||||||
|
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
|
@ -89,10 +93,10 @@ angular.module('SeHub')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.goToProject = function()
|
$scope.goToProject = function(projectId)
|
||||||
{
|
{
|
||||||
console.log("projects only from classID: " + classId)
|
console.log("projects only from classID: " + projectId)
|
||||||
$location.path('/thisProject' + classId);
|
$location.path('/project/' + projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var init = function()
|
var init = function()
|
|
@ -18,7 +18,7 @@ angular.module('SeHub')
|
||||||
$scope.goToClass = function(classId)
|
$scope.goToClass = function(classId)
|
||||||
{
|
{
|
||||||
console.log("Done! " + $scope.courses);
|
console.log("Done! " + $scope.courses);
|
||||||
$location.path('/projects/' + classId.toString()); // Will display all the projects in this course
|
$location.path('/class/' + classId.toString()); // Will display all the projects in this course
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.chooseCampusClicked = function()
|
$scope.chooseCampusClicked = function()
|
||||||
|
|
|
@ -2,31 +2,42 @@ angular.module('SeHub')
|
||||||
.controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
.controller('myProjectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||||
{
|
{
|
||||||
$scope.isEditPressed = false;
|
$scope.isEditPressed = false;
|
||||||
$scope.myProjectsEmpty = false;
|
$scope.loadingData = true;
|
||||||
var token = $cookies['com.sehub.www'];
|
$scope.myProjectsEmpty = true;
|
||||||
|
|
||||||
$scope.user = $scope.$parent.user;
|
$scope.user = $scope.$parent.user;
|
||||||
|
var token = $cookies['com.sehub.www'];
|
||||||
|
console.log(token);
|
||||||
|
|
||||||
$scope.displayMyProjects = function()
|
$scope.displayMyProjects = function()
|
||||||
{
|
{
|
||||||
apiService.getProjectsByUser(token).success(function(data)
|
apiService.getProjectsByUser(token).success(function(data)
|
||||||
{
|
{
|
||||||
console.log("Success " + data);
|
$scope.loadingData = false;
|
||||||
$scope.myProjects = data;
|
$scope.myProjects = data;
|
||||||
|
if($scope.myProjects != null && $scope.myProjects.length > 0)
|
||||||
|
{
|
||||||
|
$scope.myProjectsEmpty = false;
|
||||||
|
}
|
||||||
|
init(); // Executing the function to initialize my projects display
|
||||||
|
console.log(data);
|
||||||
|
console.log("Success");
|
||||||
}).error(function(err)
|
}).error(function(err)
|
||||||
{
|
{
|
||||||
console.log("Error: " + err);
|
console.log("Error: " + err.message);
|
||||||
});
|
});
|
||||||
if($scope.myProjects === null)
|
|
||||||
{
|
|
||||||
$scope.myProjectsEmpty = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.goToMyProject = function()
|
$scope.goToProject = function(projectId)
|
||||||
{
|
{
|
||||||
console.log("projects only from classID: " + classId)
|
for (var i = 0; i < $scope.myProjects; i++)
|
||||||
$location.path('/thisProject' + classId);
|
{
|
||||||
|
if($scope.myProjects.id === projectId)
|
||||||
|
{
|
||||||
|
console.log("project ID: " + projectId)
|
||||||
|
$location.path('/project/' + projectId);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var init = function()
|
var init = function()
|
||||||
|
@ -34,16 +45,16 @@ angular.module('SeHub')
|
||||||
$scope.arrayHolder = [];
|
$scope.arrayHolder = [];
|
||||||
var tempArr = [];
|
var tempArr = [];
|
||||||
var sizeOfSmallArrays = 3;
|
var sizeOfSmallArrays = 3;
|
||||||
for (var i = 0 ; i < $scope.projects.length ; i++) {
|
for (var i = 0 ; i < $scope.myProjects.length ; i++) {
|
||||||
if(i % sizeOfSmallArrays !== 0){
|
if(i % sizeOfSmallArrays !== 0){
|
||||||
tempArr.push($scope.projects[i]);
|
tempArr.push($scope.myProjects[i]);
|
||||||
}else{
|
}else{
|
||||||
if(i !== 0){
|
if(i !== 0){
|
||||||
$scope.arrayHolder.push(tempArr);
|
$scope.arrayHolder.push(tempArr);
|
||||||
tempArr = [];
|
tempArr = [];
|
||||||
tempArr.push($scope.projects[i]);
|
tempArr.push($scope.myProjects[i]);
|
||||||
}else{
|
}else{
|
||||||
tempArr.push($scope.projects[i]);
|
tempArr.push($scope.myProjects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
7
templates/js/controllers/projectController.js
Normal file
7
templates/js/controllers/projectController.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
angular.module('SeHub')
|
||||||
|
.controller('projectController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope',
|
||||||
|
function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}]);
|
|
@ -1,5 +1,5 @@
|
||||||
<div class = "projects">
|
<div class = "class">
|
||||||
<h1 style="margin-left:15px"><i class="fa fa-graduation-cap"></i> Class {{project.title}}</h1>
|
<h1 style="margin-left:15px"><i class="fa fa-graduation-cap"></i> Class {{project.courseName}}</h1>
|
||||||
<div layout-paddig layout-margin class="loader" ng-if="loadingData">
|
<div layout-paddig layout-margin class="loader" ng-if="loadingData">
|
||||||
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,18 +10,29 @@
|
||||||
<md-card class="cardAllProjects">
|
<md-card class="cardAllProjects">
|
||||||
<div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
|
<div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
|
||||||
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
|
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
|
||||||
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
|
<div ng-if="t.length != 1">
|
||||||
{{project.projectName}}
|
<md-button ng-click = "goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
|
||||||
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data"
|
{{project.projectName}}
|
||||||
labels="project.info.stats.macro.labels"></canvas>
|
<div layout-align="center center" style=" width:70%;">
|
||||||
</md-card>
|
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
|
||||||
|
</div>
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
<div ng-if="t.length == 1">
|
||||||
|
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
|
||||||
|
{{project.projectName}}
|
||||||
|
<!-- <div style="height:100%; width:32%;"> -->
|
||||||
|
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
|
||||||
|
<!-- </div> -->
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</md-card>
|
</md-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="!isInCourse" layout-padding layout-margin>
|
<div ng-if="!isInCourse" layout-padding layout-margin>
|
||||||
<md-button ng-click = "joinCourse()" ng class = "md-raised md-primary"> Join Course</md-button>
|
<md-button ng-click = "joinCourse()" ng class = "md-raised md-primary"> Join Class</md-button>
|
||||||
</div>
|
</div>
|
||||||
<md-content layout-padding layout-margin>
|
<md-content layout-padding layout-margin>
|
||||||
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
|
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
|
||||||
|
@ -67,6 +78,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div layout-padding layout-margin>
|
<div layout-padding layout-margin>
|
||||||
<md-button ng-click="submitNewProject()" ng class="md-raised md-primary">Submit Project</md-button>
|
<md-button ng-click="submitNewProject()" ng class="md-raised md-primary">Submit Project</md-button>
|
||||||
|
<div layout-paddig layout-margin class="loader" ng-if="loadingData">
|
||||||
|
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</md-card>
|
</md-card>
|
|
@ -114,10 +114,11 @@
|
||||||
<script src="templates/js/controllers/tasksController.js"></script>
|
<script src="templates/js/controllers/tasksController.js"></script>
|
||||||
<script src="templates/js/controllers/myClassesController.js"></script>
|
<script src="templates/js/controllers/myClassesController.js"></script>
|
||||||
<script src="templates/js/controllers/newTasksController.js"></script>
|
<script src="templates/js/controllers/newTasksController.js"></script>
|
||||||
<script src="templates/js/controllers/projectsController.js"></script>
|
<script src="templates/js/controllers/classController.js"></script>
|
||||||
<script src="templates/js/controllers/newCourseController.js"></script>
|
<script src="templates/js/controllers/newCourseController.js"></script>
|
||||||
<script src="templates/js/controllers/campusesController.js"></script>
|
<script src="templates/js/controllers/campusesController.js"></script>
|
||||||
<script src="templates/js/controllers/myProjectsController.js"></script>
|
<script src="templates/js/controllers/myProjectsController.js"></script>
|
||||||
|
<script src="templates/js/controllers/projectController.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,36 +1,43 @@
|
||||||
<div class = "myProjects">
|
<div class = "myProjects">
|
||||||
<md-content layout-padding layout-margin>
|
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> {{user.name}}'s projects</h1>
|
||||||
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> {{user.name}}'s projects</h1>
|
<div ng-if="loadingData" layout-paddig layout-margin class="loader">
|
||||||
|
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||||
|
</div>
|
||||||
|
<div ng-if = "myProjectsEmpty && !loadingData" layout-padding layout-margin>
|
||||||
|
You Are Not Related To Any Project.
|
||||||
|
</div>
|
||||||
|
<div ng-if="!myProjectsEmpty">
|
||||||
<md-card class="cardAllProjects">
|
<md-card class="cardAllProjects">
|
||||||
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding>
|
<div flex = "99" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}" layout-padding>
|
||||||
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" >
|
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" >
|
||||||
<div ng-if = "!scope.myProjectsEmpty">
|
<div ng-if="t.length != 1">
|
||||||
<div ng-if="t.length != 1">
|
<md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
|
||||||
<md-button ng-click = "goToMyProjects(project.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">{{project.projectName}}</h2>
|
||||||
<h2 class="md-title">{{project.id}}</h2>
|
<div layout-align="center center" style=" width:70%;">
|
||||||
</md-card-content>
|
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data" labels="project.info.stats.macro.labels"></canvas>
|
||||||
</md-card>
|
</div>
|
||||||
</md-button>
|
</md-card-content>
|
||||||
</div>
|
</md-card>
|
||||||
<div ng-if="t.length == 1">
|
</md-button>
|
||||||
<md-button ng-click = "goToMyProjects(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
|
</div>
|
||||||
<md-card style="width:97%;height:97%">
|
<div ng-if="t.length == 1">
|
||||||
<md-card-content>
|
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
|
||||||
<h2 class="md-title">{{project.id}}</h2>
|
<md-card style="width:97%;height:97%">
|
||||||
</md-card-content>
|
<md-card-content>
|
||||||
</md-card>
|
<h2 class="md-title">{{project.projectName}}</h2>
|
||||||
</md-button>
|
<canvas layout-padding layout-margin id="project.projectName" class="chart chart-bar" data="project.info.stats.macro.data"
|
||||||
</div>
|
labels="project.info.stats.macro.labels"></canvas>
|
||||||
|
</md-card-content>
|
||||||
|
</md-card>
|
||||||
|
</md-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<div ng-if = "scope.myProjectsEmpty">
|
|
||||||
You Do Not Have Any Project, You May Create One.
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</md-card>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- <div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
|
<!-- <div flex ="99" class = "allProjectsShow" layout = "row" ng-repeat = "t in arrayHolder" value = "{{t}}">
|
||||||
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
|
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" layout-padding>
|
||||||
|
@ -44,10 +51,6 @@
|
||||||
You Do Not Have Any Project, You May Create One.
|
You Do Not Have Any Project, You May Create One.
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
</md-card>
|
|
||||||
</md-content>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
15
templates/views/project.html
Normal file
15
templates/views/project.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<div class = "myClasses">
|
||||||
|
<md-content layout-padding layout-margin>
|
||||||
|
<h1 layout-margin style="margin-left:15px"><i class="fa fa-cube"></i> Project</h1>
|
||||||
|
Yipi Kayea Mother Fraker
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</md-content>
|
||||||
|
</div>
|
Loading…
Reference in a new issue