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

This commit is contained in:
Sagi Dayan 2015-08-02 13:44:50 +03:00
commit 65dabcad87
8 changed files with 209 additions and 65 deletions

View file

@ -8,6 +8,7 @@ angular.module('SeHub')
$scope.isCreateProjectClicked = false; $scope.isCreateProjectClicked = false;
$scope.submitNewCourseClicked = false; $scope.submitNewCourseClicked = false;
$scope.loadingData = true; $scope.loadingData = true;
$scope.creatingProject = false;
$scope.isInCourse = false; $scope.isInCourse = false;
var startDate = null; var startDate = null;
var endDate = null; var endDate = null;
@ -71,7 +72,6 @@ angular.module('SeHub')
} }
$scope.createProjectClicked = function() { $scope.createProjectClicked = function() {
// console.log("project created! is it ?!???! " + classId);
$scope.isCreateProjectClicked = !$scope.isCreateProjectClicked; $scope.isCreateProjectClicked = !$scope.isCreateProjectClicked;
if($scope.isCreateProjectClicked) if($scope.isCreateProjectClicked)
$scope.createSctionStatus = "fa fa-angle-up"; $scope.createSctionStatus = "fa fa-angle-up";
@ -80,15 +80,14 @@ angular.module('SeHub')
} }
$scope.submitNewProject = function() { $scope.submitNewProject = function() {
loadingData = true; $scope.creatingProject = true;
// debugger;
var intClassId = parseInt(classId); var intClassId = parseInt(classId);
// console.log($scope);
var jsonNewProj = { var jsonNewProj = {
'projectName': $scope.project.projectName, 'projectName': $scope.project.projectName,
'courseId': intClassId, 'courseId': intClassId,
'gitRepository': $scope.project.repoOwner + '/' + $scope.project.gitRepoName 'gitRepository': $scope.project.repoOwner + '/' + $scope.project.gitRepoName
}; };
console.log("Look Down");
console.log(jsonNewProj); console.log(jsonNewProj);
if ($scope.project.logoUrl) if ($scope.project.logoUrl)
@ -96,7 +95,7 @@ angular.module('SeHub')
apiService.createProject(token, jsonNewProj).success(function(data) apiService.createProject(token, jsonNewProj).success(function(data)
{ {
loadingData = false; $scope.loadingData = false;
projectId = data.id; 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())
@ -106,7 +105,8 @@ angular.module('SeHub')
}).error(function(err) }).error(function(err)
{ {
console.log("Error: " + err.message); $scope.creatingProject = false;
console.log(err.message);
$mdDialog.show($mdDialog.alert().title('Error Creating Project').content('You have failed Creating the project.') $mdDialog.show($mdDialog.alert().title('Error Creating Project').content('You have failed Creating the project.')
.ariaLabel('Create project alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert .ariaLabel('Create project alert dialog').ok('Try Again!').targetEvent()); // Pop-up alert
}); });

View file

@ -1,21 +1,21 @@
angular.module('SeHub') angular.module('SeHub')
.controller('homeController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) .controller('homeController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope',
function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
{ {
$scope.isStudent = false; $scope.isStudent = false;
$scope.addMsg = false; $scope.addMsg = false;
$scope.msgToPost = ""; $scope.msgToPost = "";
$scope.oldText = ""; $scope.oldText = "";
$scope.messages = []; $scope.messages = [];
$scope.userMessages = [];
$scope.messagesDisplay = []; $scope.messagesDisplay = [];
$scope.courses = []; $scope.courses = [];
$scope.campuses = []; $scope.campuses = [];
$scope.msg = {}; $scope.msg = {};
$scope.courseObj = {}; $scope.courseObj = {};
// $scope.course = ""; // should be "" ? // {} ?? $scope.user = $scope.$parent.user;
$rootScope.seToken = $cookies['com.sehub.www']; $rootScope.seToken = $cookies['com.sehub.www'];
var token = $rootScope.seToken; var token = $rootScope.seToken;
var imagePath = $scope.user.avatar_url;
if($scope.user.isLecturer) if($scope.user.isLecturer)
{ {
@ -28,6 +28,20 @@ angular.module('SeHub')
console.log("Student Mode!"); console.log("Student Mode!");
} }
$scope.displayMessages = function()
{
apiService.getAllUserMessages(token).success(function(data)
{
console.log(data);
$scope.userMessages = data;
}).error(function(err)
{
console.log("Error: " + err.message);
});
}
$scope.displayMessages(); //
$scope.addMessageClicked = function() $scope.addMessageClicked = function()
{ {
$scope.addMsg = true; // Reveal the "POST" Button $scope.addMsg = true; // Reveal the "POST" Button
@ -53,8 +67,8 @@ angular.module('SeHub')
console.log(err); console.log(err);
}); });
console.log($scope.msg.msgToAdd);
$scope.messages.push({"text": $scope.msg.msgToAdd}); $scope.messages.push({"text": $scope.msg.msgToAdd});
$location.path('/home/');
} }
else else
{ {
@ -66,30 +80,25 @@ angular.module('SeHub')
$scope.displayTasks = function() $scope.displayTasks = function()
{ {
apiService.getAllUserTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
{
$scope.tasks = data;
console.log(data);
}).error(function(err)
{
});
// apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId // apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId
// { // {
// console.log("YE");
// }).error(function(err) // }).error(function(err)
// { // {
// console.log("Error: " + err.message);
// }); // });
} }
$scope.displayMessages = function()
{
// apiService.getMessagesByGroupId(token, $scope.courseObj.id).success(function(data)
// {
// $scope.messages = data;
// console.log($scope.messages);
// }).error(function(err)
// {
// console.log(err);
// });
}
$scope.getCampuses = function() $scope.getCampuses = function()
{ {
apiService.getCampusesByUser(token).success(function(data) apiService.getCampusesByUser(token).success(function(data)
@ -98,11 +107,11 @@ angular.module('SeHub')
$scope.getCourses(); // Get all the courses info $scope.getCourses(); // Get all the courses info
if($scope.messages) if($scope.messages)
{ {
$scope.displayMessages(); // // Display all messages in message feed and the latest one //$scope.displayMessages(); // // Display all messages in message feed and the latest one
} }
}).error(function(err) }).error(function(err)
{ {
console.log("Error: " + err); console.log("Error: " + err.message);
}); });
} }
@ -122,14 +131,14 @@ angular.module('SeHub')
} }
}).error(function(err) }).error(function(err)
{ {
console.log("Error: " + err); console.log("Error: " + err.message);
}); });
} }
} }
$scope.clearAllClicked = function() // Clear Screen from text $scope.clearAllClicked = function() // Clear Screen from text
{ {
$scope.messages = []; $scope.userMessages = [];
} }
$scope.chooseCourseClicked = function() $scope.chooseCourseClicked = function()
@ -175,8 +184,8 @@ angular.module('SeHub')
$scope.getCampuses(); // Get all the campuses info $scope.getCampuses(); // Get all the campuses info
// animation // animation
// $scope.displayMessages();
// $scope.displayTasks(); // Display all tasks in task feed and the latest one $scope.displayTasks(); // Display all tasks in task feed and the latest one
$scope.isEnterd = top.setIsEnterd; $scope.isEnterd = top.setIsEnterd;
}]); }]);

View file

@ -180,6 +180,5 @@ angular.module('SeHub').controller('newTasksController', ['$scope', 'apiService'
$scope.RB = function(comp) { $scope.RB = function(comp) {
console.info(comp); console.info(comp);
} }
} }
]); ]);

View file

@ -8,10 +8,26 @@ angular.module('SeHub')
$scope.user = $scope.$parent.user; $scope.user = $scope.$parent.user;
$scope.loadingData = true; $scope.loadingData = true;
$scope.isMasterOrLecturer = false; $scope.isMasterOrLecturer = false;
$scope.isMember = false;
// $scope.thisProject = {}; // $scope.thisProject = {};
// $scope.thisProject.courseName = $routeParams.className; // $scope.thisProject.courseName = $routeParams.className;
$scope.joinProject = function()
{
apiService.joinProject(token, projectId).success(function(data)
{
$scope.isMember = true;
$scope.project = data;
$mdDialog.show($mdDialog.alert().title('Join Project').content('Joined successfully.')
.ariaLabel('Join project alert dialog').ok('Aight').targetEvent(ev));
}).error(function(err)
{
$mdDialog.show($mdDialog.alert().title('Join Project').content(err.message)
.ariaLabel('Join project alert dialog').ok('Try Again').targetEvent(ev));
});
}
$scope.editProject = function(ev) $scope.editProject = function(ev)
{ {
$scope.isEditPressed = true; $scope.isEditPressed = true;
@ -19,11 +35,21 @@ angular.module('SeHub')
$scope.removeProject = function(ev) $scope.removeProject = function(ev)
{ {
$mdDialog.show($mdDialog.alert().title('Remove Project').content('Are you sure you want to remove the project ?') $mdDialog.show($mdDialog.confirm().title('Remove Project').content('Are you sure you want to remove the project ?')
.ariaLabel('Removing project alert dialog').ok('Yes').targetEvent(ev)); .ariaLabel('Removing project alert dialog').ok('Yes').cancel('No').targetEvent(ev));
// .then(function() {
/*
.than(function()
{
$scope.alert = 'You decided to get rid of your debt.';
},
function()
{
$scope.alert = 'You decided to keep your debt.';
});
*/
// $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course // $location.path('/class/' + data.id + '/' + data.courseName); // Will display all the projects in this course
// }); // Pop-up alert
}; };
$scope.getProfileRoute = function(userName) $scope.getProfileRoute = function(userName)
@ -32,8 +58,6 @@ angular.module('SeHub')
{ {
if(userName === $scope.project.members[i].name) if(userName === $scope.project.members[i].name)
{ {
console.log(userName);
console.log($scope.project.members[i].name);
return '#/profile/' + $scope.project.members[i].id; return '#/profile/' + $scope.project.members[i].id;
} }
else else
@ -46,6 +70,13 @@ angular.module('SeHub')
apiService.getProjectsById(token, projectId).success(function(data) apiService.getProjectsById(token, projectId).success(function(data)
{ {
$scope.project = data; $scope.project = data;
for(var i = 0; i < data.members.length; i++)
{
if($scope.user.id === data.members[i].id)
{
$scope.isMember = true;
}
}
// if($scope.user === $scope.project.info.master_id) // if($scope.user === $scope.project.info.master_id)
// { // {
// $scope.isMasterOrLecturer = true; // $scope.isMasterOrLecturer = true;

View file

@ -181,6 +181,54 @@ service.factory('apiService', ['$http', function($http) {
}; };
return $http(req); return $http(req);
}, },
joinProject: function(token, projectId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/joinProject/" + token + "/" + projectId;
req = {
method: "PUT",
url: url
};
return $http(req);
},
removeProject: function(token, projectId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/projects/deleteProject/" + token + "/" + projectId;
req = {
method: "DELETE",
url: url
};
return $http(req);
},
getAllFutureTasks: function(token, courseId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureCampusTasks/" + token + "/" + courseId;
req = {
method: "GET",
url: url
};
return $http(req);
},
getAllUserTasks: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllUserTasks/" + token;
req = {
method: "GET",
url: url
};
return $http(req);
},
getAllTasksByCourse: function(token, courseId){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllTasksByCourse/" + token + "/" + courseId;
req = {
method: "GET",
url: url
};
return $http(req);
},
getAllUserMessages: function(token){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/messages/getAllUserMessages/" + token;
req = {
method: "GET",
url: url
};
return $http(req);
},
getCourseById: function(token, id){ getCourseById: function(token, id){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesById/" + token + "/" + id; var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesById/" + token + "/" + id;
req = { req = {

View file

@ -71,8 +71,8 @@
</md-input-container> </md-input-container>
</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-disabled="creatingProject" ng-click="submitNewProject()" class="md-raised md-primary">Submit Project</md-button>
<div layout-paddig layout-margin class="loader" ng-if="loadingData"> <div layout-padding layout-margin class="loader" ng-if="creatingProject">
<md-progress-circular md-mode="indeterminate"></md-progress-circular> <md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div> </div>
</div> </div>

View file

@ -30,17 +30,50 @@
<div> <div>
Closest Task- Closest Task-
<md-card layout-margin layout-padding> <md-card layout-margin layout-padding>
Will Be Here <div>
In Course: {{tasks[0].courseName}}
</div>
</md-card> </md-card>
</div> </div>
<div> <div>
Latest Message- Latest Message-
<md-card layout-margin layout-padding> <md-card layout-margin layout-padding>
Will Be Here {{userMessages[0].message}}
</md-card> </md-card>
</div> </div>
</div> </div>
<!--
<table style="width:100%;" border = "1">
<tr>
<th>Message</th>
<th style = "width:20%;">Date</th>
<th style = "width:10%;">Committer</th>
</tr>
<tr ng-repeat = "commit in project.info.commits" layout-margin align = "center">
<td>
<span ng-repeat = "msg in commit">
<a target = "_blank"ng-href="{{commit.html_url}}"
style="text-decoration:none; color:black;">
{{msg.message}}
</a>
</span>
</td>
<td>
<span ng-repeat = "date in commit.author">
{{date.date}}
</span>
</td>
<td ng-repeat = "member in project.members">
<a ng-href="#/profile/{{member.id}}" style="text-decoration:none; color:black;">
{{member.name}}
</a>
</td>
</tr>
</table>
-->
<div ng-if="user.isLecturer"> <!-- Lecturer Mode --> <div ng-if="user.isLecturer"> <!-- Lecturer Mode -->
<md-card> <md-card>
<div flex = 90> <div flex = 90>
@ -49,30 +82,47 @@
<md-tab label="Messages"> <md-tab label="Messages">
<md-content class="tabDesign"> <md-content class="tabDesign">
<md-content class="messagesContent"> <md-content class="messagesContent">
<!-- <div class = "messagesContent"> --> <md-card ng-repeat = "msg in userMessages">
<md-card ng-repeat = "msg in messages"> <div layout = "column" layout-padding>
<div layout="column"> <div flex = 30 class="md-avatar">
<div layout="row" layout-margin layout-padding> <img ng-src="{{msg.user.avatar_url}}" style="width:100%">
<div flex="10" class="md-avatar"> </div>
<img ng-src="{{user.avatar_url}}" style="width:100%"> <div flex = 20 layout = "row">
<div>
{{msg.user.username}}
</div> </div>
<div flex> <div>
<div layout = "column"> {{msg.group.courseName}}
<div> <br></br>
<b>{{user.name}}</b> {{msg.group.projectName}}
</div>
<div>
{{courseObj.courseName}}
</div>
</div>
</div> </div>
</div> </div>
<div> <div flex = 40>
<div flex="70" class="msgSent" layout-margin layout-padding> {{msg.message}}
{{msg.text}}
</div>
</div> </div>
</div> </div>
<!-- <div flex layout="column">
<div flex = 30 class="md-avatar" layout-padding layout-margin>
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<div layout = "row" flex = 15 layout-padding>
<div>
{{msg.user.username}}
</div>
<div>
{{msg.group.courseName}}
{{msg.group.projectName}}
</div>
</div>
<div flex = 50 layout-padding>
{{msg.message}}
</div>
</div> -->
</md-card> </md-card>
</md-content> </md-content>
<!-- </div> --> <!-- </div> -->
@ -81,7 +131,9 @@
<md-tab label="Tasks"> <md-tab label="Tasks">
<md-content class="md-padding"> <md-content class="md-padding">
<h1 class="md-display-2">Tasks</h1> <h1 class="md-display-2">Tasks</h1>
One <div>
</div>
</md-content> </md-content>
</md-tab> </md-tab>
<md-tab label="two"> <md-tab label="two">

View file

@ -18,6 +18,11 @@
<div layout = "row" flex = "45"> <div layout = "row" flex = "45">
<!-- <div ng-if = "isMasterOrLecturer"> --> <!-- <div ng-if = "isMasterOrLecturer"> -->
<md-card layout = "row"> <md-card layout = "row">
<div ng-if="!isMember" layout-padding>
<md-button ng-click="joinProject()" ng class = "md-raised md-primary">
<i class="fa fa-user-plus"></i>
</md-button>
</div>
<div layout-padding> <div layout-padding>
<md-button ng-click="editProject($event)" ng class="md-raised md-primary"> <md-button ng-click="editProject($event)" ng class="md-raised md-primary">
<i class="fa fa-pencil-square-o"></i> <i class="fa fa-pencil-square-o"></i>