Merge pull request #67 from sagidayan/UI

- Create course api -fixed
This commit is contained in:
Sagi Dayan 2015-06-24 22:47:40 +03:00
commit b3e5ce4716
15 changed files with 311 additions and 164 deletions

View file

@ -197,6 +197,18 @@ body.noscroll
border-radius: 1px black solid;
}*/
.allCampusesShow
{
overflow:hidden;
background-size: auto;
}
.campusCard
{
/*height:80%;*/
/*width:80%;*/
}
.gray-font
{
color: #7f7f7f;
@ -397,6 +409,11 @@ body.noscroll
border-color: solid red;
}
.cardAllCampuses
{
word-break: break-word;
}
.addMessage
{
font-size: 2em;

View file

@ -61,6 +61,14 @@ app.config(['$routeProvider', '$locationProvider',
.when('/newCourse', {
templateUrl: 'templates/views/newCourse.html',
controller: 'newCourseController'
})
.when('/campuses', {
templateUrl: 'templates/views/campuses.html',
controller: 'campusesController'
})
.when('/thisProject', {
templateUrl: 'templates/views/thisProject.html',
controller: 'thisProjectController'
});
}
]);

View file

@ -0,0 +1,17 @@
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.campuses = ['Bezalel', 'Ben Gurion', 'Sami Shamoon', 'Afeka', 'Ivrit', 'Kaka', 'Opium'];
console.log($scope.campuses);
// apiService.getCampusesByUser(token).success(function(data) // Get all the campuses
// {
// $scope.campuses = data;
// }).error(function() {
// // TODO
// });
}]);

View file

@ -35,13 +35,13 @@ angular.module('SeHub')
console.log("Student Mode!");
}
// apiService.getCourseByCampusName($scope.user.classes_id_list[0]).success(function(data)
// apiService.getCourseByCampusName(token).success(function(data)
// {
// console.log("Campus Name is ON! " + $scope.user.classes_id_list[0])
// console.log("Campus Name is ON! " + token)
// $scope.course = data;
// }).error(function()
// }).error(function(err)
// {
// console.log("Error on ===> getCourseByCampusName")
// console.log("Error ===> " + err + " ===> getCourseByCampusName")
// });

View file

@ -5,8 +5,10 @@ angular.module('SeHub')
$scope.isCourse = false;
$scope.isNewCourse = false;
$scope.newClassName = false;
$scope.user.createNewCourse = '';
$scope.course = {};
var token = $cookies['com.sehub.www'];
$scope.user.finalDate = '';
$scope.user.startDate = '';
$scope.showMyClass = false;
if($scope.user.isLecturer)
@ -21,6 +23,17 @@ angular.module('SeHub')
}
$scope.courses = ['SE', 'PC', 'Math', 'Calculus', 'Ivrit', 'English', 'Drugs'];
// apiService.getClassesByUser(token).success(function(data) // Get all the campuses
// {
// $scope.courses = data;
// }).error(function() {
// // TODO
// });
$scope.chooseCourseClicked = function()
{
$scope.isCourse = true;
@ -29,26 +42,45 @@ angular.module('SeHub')
$scope.createCourseClicked = function()
{
$scope.isNewCourse = true;
$scope.showMyClass = false;
console.log("create course Clicked!!");
}
$scope.showMyCourses = function()
{
$scope.showMyClass = true;
$scope.isNewCourse = false;
$scope.isNewCourse = !$scope.isNewCourse;
}
$scope.submitNewClassClicked = function()
{
if($scope.user.createNewCourse != '' && $scope.user.finalDate != '')
if($scope.course.courseName != '' && $scope.course.endDate != '' && $scope.course.startDate != '')
{
console.log("finalDate " + $scope.user.finalDate);
console.log($scope.user.createNewCourse);
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)
}
};
console.log("Json here:");
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());
// $window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO
.ariaLabel('Email verification alert dialog').ok('Lets Start!').targetEvent())
.then(function() {
$window.location.href = 'templates/views/newCourse.html'; // TODO TODO TODO
}); // Pop-up alert
}
else
{

View file

@ -10,7 +10,14 @@ angular.module('SeHub')
}
$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
// });
}]);

View file

@ -14,26 +14,26 @@ angular.module('SeHub')
var token = $rootScope.seToken;
apiService.getUserByToken(token).success(function(data) // Get user token
{
$scope.user = data;
{
$scope.user = data;
if (data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if (data.message == 'No User Found')
console.error("No User Found!");
console.log(data);
if ($scope.user.name === ";") {
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
}
if ($scope.user.name === ";") {
$scope.user.name = "";
$scope.user.name = $scope.user.username;
$scope.userHasNoName = true;
}
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function() {
// TODO
});
apiService.getAllCampuses(token).success(function(data) // Get all the campuses
{
$scope.campuses = data;
}).error(function() {
// TODO
});
});
$scope.dropdownClicked = function() {
if ($scope.campus) {

View file

@ -0,0 +1,16 @@
angular.module('SeHub')
.controller('thisProjectController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{
$scope.isEditPressed = false;
$scope.editPressed = function()
{
$scope.isEditPressed = true;
console.log("EditPressed " + $scope.isEditPressed);
}
$scope.removeProject = function()
{
console.log("Project has been removed!");
}
}]);

View file

@ -71,7 +71,7 @@ service.factory('apiService', ['$http', function($http) {
return $http(req);
},
createMessage: function(token, payLoad){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseMessages/" + token;
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/createMessage/" + token;
req = {
method : "POST",
url : url,
@ -80,8 +80,45 @@ service.factory('apiService', ['$http', function($http) {
};
return $http(req);
},
getCourseMessages: function(token, courseName){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCourseMessages/" + token + '/' + courseName;
getMessagesByCourseName: function(token, courseName){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getMessagesByCourseName/" + token + '/' + courseName;
req = {
method : "GET",
url : url
};
return $http(req);
},
createCourse: 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);
},
getCampusesByUser: function(){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCampusesByUser/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getClassesByCourse: function(){ // Need to add camusName (ngRoute) ~ sagi //TODO
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/ClassesByCourse/" + token;
req = {
method : "GET",
url : url
};
return $http(req);
},
getProjectsByCourse: function(){ // Need to add courseID (ngRoute) ~ sagi //TODO
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getProjectByCourse/" + token;
req = {
method : "GET",
url : url

View file

@ -0,0 +1,16 @@
<div class = "myCampuses">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-university"></i> My Campuses</h1>
</md-content>
<md-card class="cardAllCampuses">
<div class = "allCampusesShow" layout = "column">
<div layout = "row" ng-repeat = "campus in campuses" value = "{{campus}}" layout-padding>
<a href="http://localhost:8080/home#/myClasses" style="color:black; text-decoration:none;">
<md-card layout-padding class = "campusCard">
{{campus}}
</md-card>
</a>
</div>
</div>
</md-card>
</div>

View file

@ -116,6 +116,8 @@
<script src="templates/js/controllers/newTasksController.js"></script>
<script src="templates/js/controllers/projectsController.js"></script>
<script src="templates/js/controllers/newCourseController.js"></script>
<script src="templates/js/controllers/campusesController.js"></script>
<script src="templates/js/controllers/thisProjectController.js"></script>
</body>
</html>

View file

@ -2,54 +2,51 @@
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> My Classes</h1>
</md-content>
<md-card flex = "99" class="cardAllcourses">
<div flex class = "allcoursesShow" ><!-- layout = "column"> -->
<div flex layout = "row" ng-repeat = "course in courses" value = "{{course}}" layout-padding>
<a href="http://localhost:8080/home#/projects" style="color:black; text-decoration:none;">
<md-card layout-padding flex class = "campusCard">
{{course}}
</md-card>
</a>
</div>
</div>
</md-card>
<div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<div layout="row">
<div layout-margin layout-padding>
<md-button ng-click="createCourseClicked()" ng class="md-raised md-primary">Create Class</md-button>
</div>
<div layout-margin layout-padding>
<md-button ng-click="showMyCourses()" ng class="md-raised md-primary">Show My Classes</md-button>
</div>
</div>
<div ng-if="isNewCourse">
<md-content>
<md-content layout-padding layout="row" layout-sm="column">
<md-input-container>
<label>User Name</label>
<input ng-model="user.name">
</md-input-container>
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email">
</md-input-container>
</md-content>
<md-content layout-padding>
<form name="createNewCourseForm">
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label>Class Name</label>
<input ng-model="user.createNewCourse" min-length="1" required>
</md-input-container>
<md-input-container flex>
<label>Course Finish Date</label>
<input type="date" ng-model="user.finalDate" required>
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container flex>
<label>First name</label>
<input ng-model="user.firstName">
</md-input-container>
<md-input-container flex>
<label>Last Name</label>
<input ng-model="theMax">
</md-input-container>
</div>
<md-input-container flex>
<label>General Info (optional)</label>
<textarea ng-model="user.courseInfo" columns="1" md-maxlength="150"></textarea>
</md-input-container>
</form>
<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-input-container>
</div>
<div layout layout-sm="column">
<md-input-container style="width:80%">
<label flex = "50">Class Name</label>
<input ng-model="course.courseName" min-length="1" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Start Date</label>
<input type="date" ng-model="course.startDate" required>
</md-input-container>
<md-input-container flex = "20">
<label>Course Finish Date</label>
<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>
@ -61,91 +58,6 @@
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
<!-- <md-content>
<div layout="row">
<div flex="65">
<md-card>
<p class = "messagesFeed">Messages</p>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksFeed">Tasks</p>
</md-card>
</div>
</div>
<div layout="row">
<div flex="65">
<md-card>
<div class = "messagesContent">
<md-card ng-repeat = "msg in messages">
<div layout="column">
<div layout="row" layout-margin layout-padding>
<div flex="10" class="md-avatar">
<img ng-src="{{user.avatar_url}}" style="width:100%">
</div>
<div flex>
<div layout = "column">
<div>
<b>{{user.name}}</b>
</div>
<div>
class_name
</div>
</div>
</div>
</div>
<div>
<div flex="69" class="msgSent" layout-margin layout-padding>
{{msg.text}}
</div>
</div>
</div>
</md-card>
</div>
</md-card>
</div>
<div flex="34">
<md-card>
<p class = "tasksContent">
For Task 3 Press: <a href="http://localhost:8080/home#/tasks">Task #3</a>
<br></br>
For Task 4 Press: <a href="http://localhost:8080/home#/home">Task #4</a>
<br></br>
For Task 5 Press: <a href="http://localhost:8080/home#/home">Task #5</a>
<br></br>
For Task 6 Press: <a href="http://localhost:8080/home#/home">Task #6</a>
<br></br>
For Task 7 Press: <a href="http://localhost:8080/home#/home">Task #7</a>
<br></br>
For Task 8 Press: <a href="http://localhost:8080/home#/home">Task #8</a>
</p>
</md-card>
</div>
</div>
<div class ="addMessage" layout="row" layout-margin layout padding>
<div>
<md-button ng-click="addMessageClicked()" ng class="md-raised md-primary"><i class="fa fa-comments"></i></md-button>
</div>
<div ng-if="addMsg">
<md-select placeholder="Choose Course" ng-model="course" ng-click="chooseCourseClicked()" class="courseDropDown">
<md-option ng-repeat="c in courses" value="{{c.course}}">{{c.course}}</md-option>
</md-select>
</div>
</div>
<div ng-if="addMsg">
<div layout = "row" layout-margin layout padding layout-align = "left center">
<md-button ng-click="postMessageClicked()" ng class="md-raised md-primary">Post</md-button>
<md-button ng-click="clearAllClicked()" ng class="md-raised md-primary">Clear All</md-button>
</div>
<div class="port_spacer"></div>
<md-input-container>
<label> Write Your Desired Message Here And Press Post</label>
<input type="text" minlength="1" ng-model="msg.msgToAdd" required>
</md-input-container>
</div>
</md-content> -->
</div>
<div ng-if="isStudent"> <!-- Student Mode -->

View file

@ -1,6 +1,17 @@
<div class = "projects">
<h1 style="margin-left:15px"><i class="fa fa-cube"></i> Projects</h1>
<md-card flex = "99" class="cardAllProjects">
<div flex class = "allProjectsShow" layout = "column">
<div flex layout = "row" ng-repeat = "project in projects" value = "{{project}}" layout-padding>
<a href="http://localhost:8080/home#/thisProject" style="color:black; text-decoration:none;">
<md-card layout-padding flex class = "projectCard">
{{project}}
</md-card>
</a>
</div>
</div>
</md-card>
<md-content layout-padding layout-margin>
<h1 style="margin-left:15px"><i class="fa fa-file-cube-o"></i> Projects</h1>
<md-button ng-click="createProjectClicked()" ng class="md-raised md-primary">Create Project</md-button>
</md-content>
</div>

View file

@ -1,6 +1,42 @@
<div class = "tasks">
<md-content layout-padding layout-margin>
<h1 style="margin-left:15px"><i class="fa fa-file-text-o"></i> Tasks</h1>
<md-button ng-click="createTaskClicked(taskName)" ng class="md-raised md-primary">Create Task</md-button>
<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> -->
<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">Tab One</h1>
<p>Commits...</p>
</md-content>
</md-tab>
<md-tab label="Issues">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
<p>Issues...</p>
</md-content>
</md-tab>
<md-tab label="Bugs">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Three</h1>
<p> Bugs Bugs Bugs..</p>
</md-content>
</md-tab>
<md-tab label="WhatEver">
<md-content class="md-padding">
<h1 class="md-display-2">Tab Two</h1>
<p>Bla Bla Bla..</p>
</md-content>
</md-tab>
</md-tabs>
</md-content>
<!-- </md-card> -->
</div>
</md-content>
</div>

View file

@ -0,0 +1,36 @@
<div class = "thisProject">
<md-content layout-padding layout-margin>
<h1 layout-margin style="margin-left:15px"><i class="fa fa-graduation-cap"></i> {{user.name}}'s project</h1>
<div layout-padding layout-margin>
<div layout = "row" layout-padding layout-margin>
<div flex = "45">
Project Creator: {{user.name}} <!-- Should Be Project creator -->
</div>
<div flex = "45" >
<div ng-if="user.isLecturer">
<div layout = "row" layout-padding>
<div>
<md-button ng-click="editPressed()" class="md-raised md-primary">Edit</md-button>
</div>
<div ng-if="isEditPressed" style="size:inherit;">
<md-button ng-click="removeProject()" class="md-raised md-primary"><i class = "fa fa-trash-o"></i></md-button>
</div>
</div>
</div>
</div>
</div>
<div layout = "row" layout-padding layout-margin>
<div flex = "45">
<md-card>
Here Will Be Graph - Commits Over Period Of Time
</md-card>
</div>
<div flex = "45">
<md-card>
Here Will Be Graph (by columns) - Commits, Issues, Open Tasks
</md-card>
</div>
</div>
</div>
</md-content>
</div>