-getAllfutureCampusTasks - fixed

-messages in dashboard - fixed
This commit is contained in:
Matan Bar Yosef 2015-08-02 12:55:43 +03:00
parent 9bede4b399
commit dfd141229c
6 changed files with 169 additions and 59 deletions

View file

@ -87,6 +87,7 @@ angular.module('SeHub')
'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)
@ -94,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())
@ -104,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

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

View file

@ -35,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)
@ -48,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

View file

@ -189,6 +189,46 @@ service.factory('apiService', ['$http', function($http) {
}; };
return $http(req); 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

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