-Bugs fixing

- Create class bug - fixed

- Work in progress (classes, projects) - need to check API
This commit is contained in:
Matan Bar Yosef 2015-06-27 12:45:44 +03:00
parent 18ca8df227
commit 380228947b
14 changed files with 365 additions and 264 deletions

View file

@ -2,6 +2,7 @@ angular.module('SeHub')
.controller('campusesController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService, $rootScope)
{
$scope.threeSizedArray =[];
$scope.campusesEmpty = false;
var token = $cookies['com.sehub.www'];
apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
@ -21,6 +22,8 @@ angular.module('SeHub')
var i, j, counter = 0;
var newLength = 0;
if($scope.campuses != null)
{
if(($scope.campuses.length % 3) === 0)
{
newLength = ($scope.campuses.length / 3);
@ -48,6 +51,11 @@ angular.module('SeHub')
}
}
}
}
else
{
$scope.campusesEmpty = true;
}
console.log($scope.threeSizedArray); // TODO REMOVE
}

View file

@ -13,7 +13,6 @@ angular.module('SeHub')
var imagePath = $scope.user.avatar_url;
//var campusName = '';
$scope.course = '';
// $scope.campusName = '';
$scope.phones = [
@ -51,8 +50,30 @@ angular.module('SeHub')
}
$scope.postMessageClicked = function() // Posting the message itself
{
if($scope.msg.msgToAdd != null)
{
jsonNewMsg = {
'courseName': 'A', // TODO Should be ===> $scope.course.courseName
'message': $scope.msg.msgToAdd
};
// console.log("J: " + jsonNewMsg.toString() + "msg: " + $scope.msg.msgToAdd);
// apiService.createMessage(token, jsonNewMsg).success(function(data)
// {
// console.log("create Msg!");
// }).error(function(err)
// {
// console.log("Error: " + err);
// });
/*
'courseName': 'Advance Math',
'message': 'The lecture today is canceled'
*/
console.log($scope.msg.msgToAdd);
$scope.messages.push({"text": $scope.msg.msgToAdd});
}

View file

@ -31,7 +31,7 @@ angular.module('SeHub')
"title": "Projects",
"icon": "fa fa-cube",
"style": "",
"route": "/myClasses"
"route": "/projects"
}, {
"title": "Tasks",
"icon": "fa fa-clipboard",

View file

@ -1,5 +1,5 @@
angular.module('SeHub')
.controller('myClassesController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
.controller('myClassesController', ['$scope', '$location', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $location, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
$scope.isStudent = false;
$scope.isCourse = false;
@ -10,19 +10,11 @@ angular.module('SeHub')
$scope.user.finalDate = '';
$scope.user.startDate = '';
$scope.showMyClass = false;
$scope.coursesEmpty = false;
var campusId = $routeParams.campusId;
if($scope.user.isLecturer)
var displayCourses = function()
{
$scope.isStudent = false;
console.log("Lecturer Mode!");
}
else
{
$scope.isStudent = true;
console.log("Student Mode!");
}
apiService.getCoursesByUser(token, campusId).success(function(data) // Get all the courses for display
{
$scope.courses = data;
@ -32,6 +24,7 @@ angular.module('SeHub')
{
console.log("error: " + err);
});
}
$scope.goToClass = function(classId)
{
@ -52,8 +45,6 @@ angular.module('SeHub')
{
console.log("Error: " + err);
});
}
$scope.createCourseClicked = function()
@ -63,7 +54,7 @@ angular.module('SeHub')
$scope.submitNewClassClicked = function()
{
if($scope.course.courseName != '' && $scope.course.endDate != '' && $scope.course.startDate != '')
if($scope.course.courseName != null && $scope.course.endDate != null && $scope.course.startDate != null)
{
var jsonNewCourse =
{
@ -72,37 +63,34 @@ angular.module('SeHub')
'startDate': {
'year' : $scope.course.startDate.getFullYear(),
'day' : $scope.course.startDate.getDate(),
'month': ($scope.course.startDate.getMonth() + 1)
'month': $scope.course.startDate.getMonth() + 1
},
'endDate': {
'year' : $scope.course.endDate.getFullYear(),
'day' : $scope.course.endDate.getDate(),
'month': ($scope.course.endDate.getMonth() + 1)
'month': $scope.course.endDate.getMonth() + 1
}
};
// $scope.globalVar = jsonNewCourse;
console.log("Json here:");
console.log("Json here: " + $scope.chosenCampus);
console.log(jsonNewCourse);
apiService.createCourse(token, jsonNewCourse).success(function(data)
{
console.log("createCourse API done");
}).error(function(err)
{
console.log(err);
});
$mdDialog.show($mdDialog.alert().title('Course Created').content('You have created course successfully.')
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() {
$window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO
}); // Pop-up alert
}).error(function(err)
{
console.log(err);
});
}
else
{
$mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('You have encountered and error in creating the course.')
$mdDialog.show($mdDialog.alert().title('Error - Creating Course').content('Some fields are missing.')
.ariaLabel('Email verification alert dialog').ok('Try Again!').targetEvent());
}
}
@ -112,6 +100,8 @@ angular.module('SeHub')
var i, j, counter = 0;
var newLength = 0;
if($scope.courses != null)
{
if(($scope.courses.length % 3) === 0)
{
newLength = ($scope.courses.length / 3);
@ -139,9 +129,28 @@ angular.module('SeHub')
}
}
}
}
else
{
$scope.coursesEmpty = true;
}
console.log($scope.holdArrays);
}
if($scope.user.isLecturer)
{
$scope.isStudent = false;
console.log("Lecturer Mode!");
}
else
{
$scope.isStudent = true;
console.log("Student Mode!");
}
displayCourses(); // Will display the courses that the user related to // TODO!!
}]);

View file

@ -1,10 +1,8 @@
angular.module('SeHub')
.controller('newCourseController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
$scope.goBack = function()
{
$window.location.href = 'templates/views/myClasses.html';
}
}]);

View file

@ -1,29 +1,51 @@
angular.module('SeHub')
.controller('projectsController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
.controller('projectsController', ['$scope', '$routeParams', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $routeParams, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
console.log("in projects controller");
var token = $cookies['com.sehub.www'];
var classId = $routeParams.id;
$scope.projectEmpty = false;
$scope.displayProjects = function()
{
console.log("in displayProjecs!!! ");
apiService.getProjectsByCourse(token, classId).success(function(data) // Get all the campuses
{
$scope.projects = data;
init(); // Executing the function to initialize projects display
console.log("project created! not rly!! " + classId);
}).error(function(err)
{
console.log("Error: " + err);
});
}
$scope.displayProjects(); // Displaying all projects related to user
$scope.createProjectClicked = function()
{
console.log("project created! not rly!! ");
console.log("project created! not rly!! " + classId);
// $window.location.href = 'http://localhost:8080/home#/tasks/new'; // Reference to 'newTask' page
}
$scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs'];
// $scope.projects = ['AMI', 'LULU', 'XIN Zhau', 'LUMI lu', 'Shimi', 'Azligi zligi', 'Drugs'];
// apiService.getProjectsByCourse(courseId).success(function(data) // Get all the campuses
// {
// $scope.projects = data;
// }).error(function() {
// // TODO
// });
$scope.goToProject = function()
{
console.log("projects only from classID: " + classId)
$location.path('/thisProject' + classId);
}
var init = function()
{
var i, j, counter = 0;
var newLength = 0;
if($scope.projects != null)
{
if(($scope.projects.length % 3) === 0)
{
newLength = ($scope.projects.length / 3);
@ -53,8 +75,47 @@ angular.module('SeHub')
}
console.log($scope.arrayHolder);
}
else
{
$scope.projectEmpty = true;
}
}
/*
var jsonNewCourse =
{
'courseName': $scope.course.courseName,
'campusName': $scope.course.campusName,
'startDate': {
'year' : $scope.course.startDate.getFullYear(),
'day' : $scope.course.startDate.getDate(),
'month': $scope.course.startDate.getMonth() + 1
},
'endDate': {
'year' : $scope.course.endDate.getFullYear(),
'day' : $scope.course.endDate.getDate(),
'month': $scope.course.endDate.getMonth() + 1
}
};*/
/*
{
'projectName': 'Advance Math',
'courseName': 'JCE',
'grade': 98,
'logo_url': 'http://location.domain.com/image.jpg',
'gitRepository': 'http://location.git.com/somthing',
'membersId': ['bob', 'dylan', 'quentin', 'terentino'],
'id' : 1234567890
}
*/
init(); // Executing the function to initialize projects display
}]);

View file

@ -8,7 +8,6 @@ angular.module('SeHub')
var taskName = name;
console.log("task created! " + taskName);
$location.path("/tasks/new"); // Reference to 'newTask' page
}

View file

@ -95,7 +95,6 @@ service.factory('apiService', ['$http', function($http) {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
},
@ -142,6 +141,23 @@ service.factory('apiService', ['$http', function($http) {
};
return $http(req);
},
joinCourse: function(token, courseId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/users/getUserById/" + token + "/" + courseId;
req = {
method : "PUT",
url : url
};
return $http(req);
},
createMessage: function(token, payLoad){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/create/" + token;
req = {
method : "POST",
url : url,
data: payLoad
};
return $http(req);
}
};
}]);

View file

@ -3,6 +3,7 @@
<h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> Pick A Campus</h1>
</md-content>
<md-card class="cardAllCampuses">
<div ng-if = "!scope.campusesEmpty">
<div class = "allCampusesShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "campus in t" value = "{{campus}}">
<md-button ng-click = "goToCampus(campus.id)" style="width:32%; height:32%;" flex="32" layout-padding class = "md-raised">
@ -11,5 +12,11 @@
</md-button>
</div>
</div>
</div>
<div ng-if = "scope.campusesEmpty">>
<md-card>
You Are Not Related To Any Course, You Can Join A Course By Press 'Join'.
</md-card>
</div>
</md-card>
</div>

View file

@ -112,68 +112,6 @@
</div>
</div>
</md-content>
<md-content layout-padding layout-margin>
<h1>
<em><i class="fa fa-folder-open"></i> Project Evaluation</em>
</h1>
<md-select placeholder="Choose Project" ng-model="project" ng-click="chooseProjectClicked()" style="z-index: 300" class="projectDropDown">
</md-select>
<div layout = "column" layout-margin layout-padding>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit" >
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
</div>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
</div>
<div layout="row">
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
<a href="http://localhost:8080/home#/projects">
<md-card flex class = "projectExhibit">
Press On Me
</md-card>
</a>
</div>
</div>
</md-content>
</div>
<div ng-if="isStudent"> <!-- Student Mode -->
<md-content>

View file

@ -5,15 +5,19 @@
<md-card class="cardAllcourses">
<div flex = "99" class = "allcoursesShow" layout = "row" ng-repeat = "t in holdArrays" value = "{{t}}">
<div flex ="32" layout = "column" ng-repeat = "course in t" value = "{{course}}" layout-padding>
<!-- <a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;"> -->
<div ng-of = "!scope.coursesEmpty">
aaa
<md-card ng-click = "goToClass(course.id)" style="width:32%; height:32%;" layout-padding class = "campusCard">
{{course.id}}
</md-card>
<!-- </a> -->
</div>
<div ng-if = "scope.coursesEmpty">
You Are Not Related To Any Course, You May Join Any Course You Wish.
</div>
</div>
</div>
</md-card>
<!-- <md-button ng-click="joinCourseClicked()" ng class="md-raised md-primary">Join Class</md-button> -->
<div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<div layout="row">
<div layout-margin layout-padding>
@ -21,20 +25,15 @@
</div>
</div>
<div ng-if="isNewCourse">
<md-content>
<md-content layout-padding>
<md-card layout-padding>
<form name="createNewCourseForm">
<div layout layout-sm="column">
<md-input-container flex = "50">
<label>Campus name</label>
<input ng-model="course.campusName" required>
<!-- <md-select placeholder="Pick your Class" ng-model="chosenCampus" style="z-index: 400" ng-change="chooseCourseClicked()"> -->
<!-- <md-option ng-switch="user.isLecturer" ng-repeat="c in campuses" value="{{c.title}}"> -->
<!-- {{c.title}} -->
<!-- </md-option> -->
<!-- </md-select> -->
</md-input-container>
<!-- <input ng-model="course.campusName" required> -->
<md-select placeholder = "Campus name" ng-model="course.campusName" ng-click = "chooseCourseClicked()" required>
<md-option ng-repeat="c in campuses" value="{{c.title}}">
{{c.title}}
</md-option>
</md-select>
</div>
<div layout layout-sm="column">
<md-input-container style="width:80%">
@ -50,9 +49,8 @@
<input type="date" ng-model="course.endDate" required>
</md-input-container>
</div>
</form>
</md-card>
</md-content>
<div layout-padding layout-margin>
<md-button ng-click="submitNewClassClicked()" class="md-raised md-primary">Submit New Class</md-button>
</div>

View file

@ -3,11 +3,14 @@
<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>
<!-- <a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;"> -->
<div ng-if = "!scope.projectEmpty">
<md-card layout-padding ng-click = "goToProject(project.id)" style="width:32%; height:32%;" class = "projectCard">
{{project.id}}
</md-card>
<!-- </a> -->
</div>
</div>
<div ng-if = "scope.projectEmpty">
You Are Not Related To Any Course, You May Join Any Course You Wish.
</div>
</div>
</md-card>

View file

@ -3,28 +3,27 @@
<h1 style="margin-left:15px"><i class="fa fa-file-text-o"></i> Tasks</h1>
<div ng-if="user.isLecturer">
<md-button ng-click="createTaskClicked(taskName)" ng class="md-raised md-primary">Create Task</md-button>
</div>
<div>
<!-- <md-card> -->
<div flex>
<md-card>
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Commits">
<md-tab label="Submitted">
<md-content class="md-padding">
<h1 class="md-display-2">Commits</h1>
<p>Commits...</p>
<h1 class="md-display-2">Submitted</h1>
<p>Submitted...</p>
</md-content>
</md-tab>
<md-tab label="Issues">
<md-tab label="Delayed">
<md-content class="md-padding">
<h1 class="md-display-2">Issues</h1>
<p>Issues...</p>
<h1 class="md-display-2">Delayed</h1>
<p>Delayed...</p>
</md-content>
</md-tab>
<md-tab label="Bugs">
<md-tab label="Not Submitted">
<md-content class="md-padding">
<h1 class="md-display-2">Bugs</h1>
<p> Bugs Bugs Bugs..</p>
<h1 class="md-display-2">Not Submitted</h1>
<p> Not Submitted ..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
@ -35,8 +34,19 @@
</md-tab>
</md-tabs>
</md-content>
<!-- </md-card> -->
</md-card>
</div>
<!-- Should Be In Table List -->
<div class = "allProjectsShow" flex = "99" layout = "row" ng-repeat = "t in threeSizedArray" value = "{{t}}" layout-padding>
<div flex = "32" layout = "column" ng-repeat = "project in t" value = "{{project}}">
<md-button ng-click = "goToProject(project.id)" style="width:32%; height:32%;" flex="32" layout-padding class = "md-raised">
<!-- <img src="{{campus.avatar_url}}" style = "width:14%; height:auto;"> -->
{{project.title}}
</md-button>
</div>
</div>
<!-- Should Be In Table List -->
</div>
</md-content>
</div>

View file

@ -13,7 +13,8 @@
<md-button ng-click="editPressed()" class="md-raised md-primary">Edit</md-button>
</div>
<div ng-if="isEditPressed">
<md-button ng-click="removeProject()" class="md-raised md-primary"><i class = "fa fa-trash-o"></i></md-button>
<md-button ng-click="removeProject()" class="md-raised md-primary">Remove</md-button>
<!-- <i class = "fa fa-trash-o"></i> -->
</div>
</div>
</div>
@ -31,6 +32,38 @@
</md-card>
</div>
</div>
<div flex>
<md-card>
<md-content class="md-padding">
<md-tabs md-dynamic-height md-border-bottom>
<md-tab label="Commits">
<md-content class="md-padding">
<h1 class="md-display-2">Commits</h1>
<p>Commits...</p>
</md-content>
</md-tab>
<md-tab label="Issues">
<md-content class="md-padding">
<h1 class="md-display-2">Issues</h1>
<p>Issues...</p>
</md-content>
</md-tab>
<md-tab label="Bugs">
<md-content class="md-padding">
<h1 class="md-display-2">Bugs</h1>
<p> Bugs Bugs Bugs..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
<md-content class="md-padding">
<h1 class="md-display-2">WhatEver</h1>
<p>Bla Bla Bla..</p>
</md-content>
</md-tab>
</md-tabs>
</md-content>
</md-card>
</div>
</div>
</md-content>
</div>