commit
d0ec66a192
9 changed files with 85 additions and 39 deletions
|
@ -54,9 +54,9 @@ app.config(['$routeProvider', '$locationProvider',
|
|||
templateUrl: 'templates/views/newTask.html',
|
||||
controller: 'newTasksController'
|
||||
})
|
||||
.when('/projects/:classId', {
|
||||
templateUrl: 'templates/views/projects.html',
|
||||
controller: 'projectsController'
|
||||
.when('/class/:projectId', {
|
||||
templateUrl: 'templates/views/class.html',
|
||||
controller: 'classController'
|
||||
})
|
||||
.when('/newCourse', {
|
||||
templateUrl: 'templates/views/newCourse.html',
|
||||
|
@ -66,6 +66,10 @@ app.config(['$routeProvider', '$locationProvider',
|
|||
templateUrl: 'templates/views/campuses.html',
|
||||
controller: 'campusesController'
|
||||
})
|
||||
.when('/project/:projectId', {
|
||||
templateUrl: 'templates/views/project.html',
|
||||
controller: 'projectController'
|
||||
})
|
||||
.when('/myProjects', {
|
||||
templateUrl: 'templates/views/myProjects.html',
|
||||
controller: 'myProjectsController'
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
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 classId = $routeParams.classId;
|
||||
var classId = $routeParams.projectId;
|
||||
// var projectId = "";
|
||||
$scope.projectsEmpty = true;
|
||||
$scope.isCreateProjectClicked = false;
|
||||
$scope.submitNewCourseClicked = false;
|
||||
$scope.project = {};
|
||||
$scope.loadingData = true;
|
||||
$scope.isInCourse = false;
|
||||
$scope.project.courseName = classId;
|
||||
|
||||
$scope.displayProjects = function()
|
||||
{
|
||||
|
@ -37,7 +39,7 @@ angular.module('SeHub')
|
|||
$mdDialog.show($mdDialog.alert().title('Joined Course').content('You have successfully joined course.')
|
||||
.ariaLabel('Join course alert dialog').ok('Lets Start!').targetEvent())
|
||||
.then(function() {
|
||||
$location.path('/projects/' + classId); // TODO TODO TODO
|
||||
$location.path('/class/' + classId); // TODO TODO TODO
|
||||
}); // Pop-up alert
|
||||
}).error(function(err)
|
||||
{
|
||||
|
@ -57,6 +59,7 @@ angular.module('SeHub')
|
|||
|
||||
$scope.submitNewProject = function()
|
||||
{
|
||||
loadingData = true;
|
||||
// debugger;
|
||||
var intClassId = parseInt(classId);
|
||||
// console.log($scope);
|
||||
|
@ -74,11 +77,13 @@ angular.module('SeHub')
|
|||
|
||||
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.')
|
||||
.ariaLabel('Project created alert dialog').ok('Great!').targetEvent());
|
||||
// .then(function() {
|
||||
// $location.path('/projects/' + classId); // TODO TODO TODO
|
||||
// }); // Pop-up alert
|
||||
.ariaLabel('Project created alert dialog').ok('Great!').targetEvent())
|
||||
.then(function() {
|
||||
$location.path('/project/' + projectId); // TODO TODO TODO
|
||||
}); // Pop-up alert
|
||||
|
||||
}).error(function(err)
|
||||
{
|
||||
|
@ -89,10 +94,10 @@ angular.module('SeHub')
|
|||
|
||||
}
|
||||
|
||||
$scope.goToProject = function()
|
||||
$scope.goToProject = function(projectId)
|
||||
{
|
||||
console.log("projects only from classID: " + classId)
|
||||
$location.path('/thisProject' + classId);
|
||||
console.log("projects only from classID: " + projectId)
|
||||
$location.path('/project/' + projectId);
|
||||
}
|
||||
|
||||
var init = function()
|
|
@ -18,7 +18,7 @@ angular.module('SeHub')
|
|||
$scope.goToClass = function(classId)
|
||||
{
|
||||
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()
|
||||
|
|
|
@ -2,31 +2,39 @@ angular.module('SeHub')
|
|||
.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.myProjectsEmpty = false;
|
||||
var token = $cookies['com.sehub.www'];
|
||||
|
||||
$scope.loadingDate = true;
|
||||
$scope.myProjectsEmpty = true;
|
||||
$scope.user = $scope.$parent.user;
|
||||
var token = $cookies['com.sehub.www'];
|
||||
console.log(token);
|
||||
|
||||
$scope.displayMyProjects = function()
|
||||
{
|
||||
apiService.getProjectsByUser(token).success(function(data)
|
||||
{
|
||||
console.log("Success " + data);
|
||||
$scope.loadingDate = false;
|
||||
$scope.myProjects = data;
|
||||
if($scope.myProjects != null && $scope.myProjects.length > 0)
|
||||
{
|
||||
$scope.myProjectsEmpty = false;
|
||||
}
|
||||
}).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)
|
||||
$location.path('/thisProject' + classId);
|
||||
for (var i = 0; i < $scope.myProjects; i++)
|
||||
{
|
||||
if($scope.myProjects.id === projectId)
|
||||
{
|
||||
console.log("project ID: " + projectId)
|
||||
$location.path('/project/' + projectId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var init = function()
|
||||
|
|
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">
|
||||
<h1 style="margin-left:15px"><i class="fa fa-graduation-cap"></i> Class {{project.title}}</h1>
|
||||
<div class = "class">
|
||||
<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">
|
||||
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
|
||||
</div>
|
||||
|
@ -21,7 +21,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<md-content layout-padding layout-margin>
|
||||
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
|
||||
|
@ -67,6 +67,9 @@
|
|||
</div>
|
||||
<div layout-padding layout-margin>
|
||||
<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>
|
||||
</md-card>
|
|
@ -114,10 +114,11 @@
|
|||
<script src="templates/js/controllers/tasksController.js"></script>
|
||||
<script src="templates/js/controllers/myClassesController.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/campusesController.js"></script>
|
||||
<script src="templates/js/controllers/myProjectsController.js"></script>
|
||||
<script src="templates/js/controllers/projectController.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,12 +1,18 @@
|
|||
<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="!myProjects">
|
||||
<md-card class="cardAllProjects">
|
||||
<div flex = "99" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}" layout-padding>
|
||||
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}" >
|
||||
<div ng-if = "!scope.myProjectsEmpty">
|
||||
<div ng-if="t.length != 1">
|
||||
<md-button ng-click = "goToMyProjects(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised" >
|
||||
<md-button ng-click="goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
|
||||
<md-card style="width:97%;height:97%">
|
||||
<md-card-content>
|
||||
<h2 class="md-title">{{project.id}}</h2>
|
||||
|
@ -15,7 +21,7 @@
|
|||
</md-button>
|
||||
</div>
|
||||
<div ng-if="t.length == 1">
|
||||
<md-button ng-click = "goToMyProjects(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised" >
|
||||
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" layout-padding class = "md-raised">
|
||||
<md-card style="width:97%;height:97%">
|
||||
<md-card-content>
|
||||
<h2 class="md-title">{{project.id}}</h2>
|
||||
|
@ -30,7 +36,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</md-card>
|
||||
</div>
|
||||
|
||||
<!-- <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>
|
||||
|
@ -44,10 +51,6 @@
|
|||
You Do Not Have Any Project, You May Create One.
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
</md-card>
|
||||
</md-content>
|
||||
</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