Merge branch 'master' of https://github.com/sagidayan/SE-Hub into API_Dev

This commit is contained in:
Aran Zaiger 2015-06-29 20:14:10 +03:00
commit 8912ca07fa
9 changed files with 129 additions and 70 deletions

View file

@ -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'

View file

@ -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()
{
@ -27,7 +29,6 @@ angular.module('SeHub')
{
console.log("Error: " + err);
});
}
$scope.joinCourse = function()
{
@ -37,7 +38,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 +58,7 @@ angular.module('SeHub')
$scope.submitNewProject = function()
{
loadingData = true;
// debugger;
var intClassId = parseInt(classId);
// console.log($scope);
@ -74,11 +76,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 +93,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()

View file

@ -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()

View file

@ -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)
{
$scope.isEditPressed = false;
$scope.myProjectsEmpty = false;
var token = $cookies['com.sehub.www'];
$scope.loadingData = 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.loadingData = false;
$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)
{
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()
@ -34,16 +45,16 @@ angular.module('SeHub')
$scope.arrayHolder = [];
var tempArr = [];
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){
tempArr.push($scope.projects[i]);
tempArr.push($scope.myProjects[i]);
}else{
if(i !== 0){
$scope.arrayHolder.push(tempArr);
tempArr = [];
tempArr.push($scope.projects[i]);
tempArr.push($scope.myProjects[i]);
}else{
tempArr.push($scope.projects[i]);
tempArr.push($scope.myProjects[i]);
}
}
};

View 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)
{
}]);

View file

@ -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>
@ -10,18 +10,29 @@
<md-card class="cardAllProjects">
<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>
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project.projectName}}
<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 ng-if="t.length != 1">
<md-button ng-click = "goToProject(project.id)" style="width:100%; height:32%;" layout-padding class = "md-raised">
{{project.projectName}}
<div layout-align="center center" style=" width:70%;">
<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>
</md-card>
</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 +78,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>

View file

@ -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>

View file

@ -1,36 +1,43 @@
<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">
<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 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-card style="width:97%;height:97%">
<md-card-content>
<h2 class="md-title">{{project.id}}</h2>
</md-card-content>
</md-card>
</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-card style="width:97%;height:97%">
<md-card-content>
<h2 class="md-title">{{project.id}}</h2>
</md-card-content>
</md-card>
</md-button>
</div>
<div ng-if="t.length != 1">
<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.projectName}}</h2>
<div layout-align="center center" style=" width:70%;">
<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-content>
</md-card>
</md-button>
</div>
<div ng-if="t.length == 1">
<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.projectName}}</h2>
<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-content>
</md-card>
</md-button>
</div>
<div class="spacer"></div>
<div ng-if = "scope.myProjectsEmpty">
You Do Not Have Any Project, You May Create One.
</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>

View 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>