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

View file

@ -1,21 +1,21 @@
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.addMsg = false;
$scope.msgToPost = "";
$scope.oldText = "";
$scope.messages = [];
$scope.userMessages = [];
$scope.messagesDisplay = [];
$scope.courses = [];
$scope.campuses = [];
$scope.msg = {};
$scope.courseObj = {};
// $scope.course = ""; // should be "" ? // {} ??
$scope.user = $scope.$parent.user;
$rootScope.seToken = $cookies['com.sehub.www'];
var token = $rootScope.seToken;
var imagePath = $scope.user.avatar_url;
if($scope.user.isLecturer)
{
@ -28,6 +28,20 @@ angular.module('SeHub')
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.addMsg = true; // Reveal the "POST" Button
@ -53,8 +67,8 @@ angular.module('SeHub')
console.log(err);
});
console.log($scope.msg.msgToAdd);
$scope.messages.push({"text": $scope.msg.msgToAdd});
$location.path('/home/');
}
else
{
@ -66,30 +80,25 @@ angular.module('SeHub')
$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
// {
// console.log("YE");
// }).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()
{
apiService.getCampusesByUser(token).success(function(data)
@ -98,11 +107,11 @@ angular.module('SeHub')
$scope.getCourses(); // Get all the courses info
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)
{
console.log("Error: " + err);
console.log("Error: " + err.message);
});
}
@ -122,14 +131,14 @@ angular.module('SeHub')
}
}).error(function(err)
{
console.log("Error: " + err);
console.log("Error: " + err.message);
});
}
}
$scope.clearAllClicked = function() // Clear Screen from text
{
$scope.messages = [];
$scope.userMessages = [];
}
$scope.chooseCourseClicked = function()
@ -175,8 +184,8 @@ angular.module('SeHub')
$scope.getCampuses(); // Get all the campuses info
// animation
// $scope.displayTasks(); // Display all tasks in task feed and the latest one
// $scope.displayMessages();
$scope.displayTasks(); // Display all tasks in task feed and the latest one
$scope.isEnterd = top.setIsEnterd;
}]);

View file

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

View file

@ -8,10 +8,26 @@ angular.module('SeHub')
$scope.user = $scope.$parent.user;
$scope.loadingData = true;
$scope.isMasterOrLecturer = false;
$scope.isMember = false;
// $scope.thisProject = {};
// $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.isEditPressed = true;
@ -19,11 +35,21 @@ angular.module('SeHub')
$scope.removeProject = function(ev)
{
$mdDialog.show($mdDialog.alert().title('Remove Project').content('Are you sure you want to remove the project ?')
.ariaLabel('Removing project alert dialog').ok('Yes').targetEvent(ev));
// .then(function() {
$mdDialog.show($mdDialog.confirm().title('Remove Project').content('Are you sure you want to remove the project ?')
.ariaLabel('Removing project alert dialog').ok('Yes').cancel('No').targetEvent(ev));
/*
.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
// }); // Pop-up alert
};
$scope.getProfileRoute = function(userName)
@ -32,8 +58,6 @@ angular.module('SeHub')
{
if(userName === $scope.project.members[i].name)
{
console.log(userName);
console.log($scope.project.members[i].name);
return '#/profile/' + $scope.project.members[i].id;
}
else
@ -46,6 +70,13 @@ angular.module('SeHub')
apiService.getProjectsById(token, projectId).success(function(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)
// {
// $scope.isMasterOrLecturer = true;

View file

@ -181,6 +181,54 @@ service.factory('apiService', ['$http', function($http) {
};
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){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/courses/getCoursesById/" + token + "/" + id;
req = {

View file

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

View file

@ -30,17 +30,50 @@
<div>
Closest Task-
<md-card layout-margin layout-padding>
Will Be Here
<div>
In Course: {{tasks[0].courseName}}
</div>
</md-card>
</div>
<div>
Latest Message-
<md-card layout-margin layout-padding>
Will Be Here
{{userMessages[0].message}}
</md-card>
</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 -->
<md-card>
<div flex = 90>
@ -49,30 +82,47 @@
<md-tab label="Messages">
<md-content class="tabDesign">
<md-content class="messagesContent">
<!-- <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%">
<md-card ng-repeat = "msg in userMessages">
<div layout = "column" layout-padding>
<div flex = 30 class="md-avatar">
<img ng-src="{{msg.user.avatar_url}}" style="width:100%">
</div>
<div flex = 20 layout = "row">
<div>
{{msg.user.username}}
</div>
<div flex>
<div layout = "column">
<div>
<b>{{user.name}}</b>
</div>
<div>
{{courseObj.courseName}}
</div>
</div>
<div>
{{msg.group.courseName}}
<br></br>
{{msg.group.projectName}}
</div>
</div>
<div>
<div flex="70" class="msgSent" layout-margin layout-padding>
{{msg.text}}
</div>
</div>
<div flex = 40>
{{msg.message}}
</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-content>
<!-- </div> -->
@ -81,7 +131,9 @@
<md-tab label="Tasks">
<md-content class="md-padding">
<h1 class="md-display-2">Tasks</h1>
One
<div>
</div>
</md-content>
</md-tab>
<md-tab label="two">

View file

@ -18,6 +18,11 @@
<div layout = "row" flex = "45">
<!-- <div ng-if = "isMasterOrLecturer"> -->
<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>
<md-button ng-click="editProject($event)" ng class="md-raised md-primary">
<i class="fa fa-pencil-square-o"></i>