commit
96744a81a6
7 changed files with 205 additions and 197 deletions
|
@ -403,7 +403,7 @@ def getAllFutureTasks(token):
|
|||
<br>
|
||||
"""
|
||||
|
||||
user = get_user_by_token
|
||||
user = get_user_by_token(token)
|
||||
if user is None:
|
||||
return bad_request("Bad User Token")
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ angular.module('SeHub')
|
|||
$scope.oldText = "";
|
||||
$scope.messages = [];
|
||||
$scope.userMessages = [];
|
||||
$scope.userTasks = [];
|
||||
$scope.messagesDisplay = [];
|
||||
$scope.courses = [];
|
||||
$scope.campuses = [];
|
||||
|
@ -32,7 +33,7 @@ angular.module('SeHub')
|
|||
{
|
||||
apiService.getAllUserMessages(token).success(function(data)
|
||||
{
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
$scope.userMessages = data;
|
||||
}).error(function(err)
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ angular.module('SeHub')
|
|||
});
|
||||
}
|
||||
|
||||
$scope.displayMessages(); //
|
||||
// $scope.displayMessages(); //
|
||||
|
||||
$scope.addMessageClicked = function()
|
||||
{
|
||||
|
@ -64,10 +65,10 @@ angular.module('SeHub')
|
|||
}).error(function(err)
|
||||
{
|
||||
console.log("Error Below");
|
||||
console.log(err);
|
||||
console.log(err.message);
|
||||
});
|
||||
|
||||
$scope.messages.push({"text": $scope.msg.msgToAdd});
|
||||
$scope.userMessages.push({"text": $scope.msg.msgToAdd});
|
||||
$location.path('/home/');
|
||||
}
|
||||
else
|
||||
|
@ -78,25 +79,54 @@ angular.module('SeHub')
|
|||
$scope.msg.msgToAdd = null;
|
||||
}
|
||||
|
||||
$scope.gotoTask = function(task)
|
||||
{
|
||||
console.log(task);
|
||||
if(task.isPersonal)
|
||||
{
|
||||
$location.path('/tasks/fill/' + task.id + '/' + $scope.user.id);
|
||||
}
|
||||
else // it's a project task
|
||||
{
|
||||
apiService.getProjectsByCourse(token, task.courseId).success(function(data)
|
||||
{
|
||||
console.log($scope.user);
|
||||
for(var i = 0; i < $scope.user.projects_id_list.length; i++)
|
||||
for(var j = 0; j < data.length; j++)
|
||||
{
|
||||
if($scope.user.projects_id_list[i] === data[j])
|
||||
{
|
||||
$location.path('/tasks/fill/' + task.id + '/' + data[j].id);
|
||||
}
|
||||
}
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.displayTasks = function()
|
||||
{
|
||||
apiService.getAllUserTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
|
||||
apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
|
||||
{
|
||||
$scope.tasks = data;
|
||||
$scope.userTasks = data;
|
||||
console.log(data);
|
||||
}).error(function(err)
|
||||
{
|
||||
|
||||
console.log(err.message);
|
||||
});
|
||||
}
|
||||
|
||||
// apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId
|
||||
// {
|
||||
// console.log("YE");
|
||||
// }).error(function(err)
|
||||
// {
|
||||
// console.log("Error: " + err.message);
|
||||
// });
|
||||
|
||||
$scope.getProjects = function(courseId)
|
||||
{
|
||||
apiService.getProjectsByCourse(token, courseId).success(function(data)
|
||||
{
|
||||
return data;
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log(err.message);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getCampuses = function()
|
||||
|
@ -105,13 +135,13 @@ angular.module('SeHub')
|
|||
{
|
||||
$scope.campuses = data;
|
||||
$scope.getCourses(); // Get all the courses info
|
||||
if($scope.messages)
|
||||
if($scope.userMessages)
|
||||
{
|
||||
//$scope.displayMessages(); // // Display all messages in message feed and the latest one
|
||||
}
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log("Error: " + err.message);
|
||||
console.log(err.message);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -157,25 +187,6 @@ angular.module('SeHub')
|
|||
console.log($scope.courseObj);
|
||||
}
|
||||
|
||||
// $scope.chooseCourseClicked = function()
|
||||
// {
|
||||
// console.log("Click ");
|
||||
// console.log($scope.choosenCourse);
|
||||
// if($scope.choosenCourse)
|
||||
// {
|
||||
// console.log("here");
|
||||
// $scope.courseObj = null;
|
||||
// for(var i = 0; i < $scope.courses.length; i++)
|
||||
// {
|
||||
// if($scope.courses[i].courseName === $scope.choosenCourse)
|
||||
// {
|
||||
// $scope.courseObj = $scope.courses[i];
|
||||
// console.log($scope.courseObj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$scope.chooseProjectClicked = function()
|
||||
{
|
||||
console.log("choose project Clicked!!");
|
||||
|
@ -184,8 +195,13 @@ angular.module('SeHub')
|
|||
$scope.getCampuses(); // Get all the campuses info
|
||||
|
||||
// animation
|
||||
if($scope.userMessages)
|
||||
{
|
||||
$scope.displayMessages(); // // Display all messages in message feed and the latest one
|
||||
}
|
||||
// $scope.displayMessages();
|
||||
$scope.displayTasks(); // Display all tasks in task feed and the latest one
|
||||
// $scope.getProjects(); // Get all projects info
|
||||
$scope.isEnterd = top.setIsEnterd;
|
||||
|
||||
}]);
|
|
@ -52,7 +52,6 @@ angular.module('SeHub')
|
|||
}];
|
||||
|
||||
dataService.initService($scope); //Start Data Sync Service (For User)
|
||||
console.log(data);
|
||||
if ($scope.user.isFirstLogin) {
|
||||
$scope.menuObj = {};
|
||||
$scope.isInRegisterMode = true;
|
||||
|
|
|
@ -1,14 +1,32 @@
|
|||
angular.module('SeHub')
|
||||
.controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
||||
{
|
||||
console.log("in controller");
|
||||
$scope.lecturerTasks = [];
|
||||
$rootScope.seToken = $cookies['com.sehub.www'];
|
||||
var token = $rootScope.seToken;
|
||||
|
||||
$scope.createTaskClicked = function()
|
||||
{
|
||||
$location.path("/tasks/new"); // Reference to 'newTask' page
|
||||
}
|
||||
|
||||
$scope.displayTasks = function()
|
||||
{
|
||||
apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK
|
||||
{
|
||||
$scope.lecturerTasks = data;
|
||||
console.log(data);
|
||||
}).error(function(err)
|
||||
{
|
||||
console.log(err.message);
|
||||
});
|
||||
}
|
||||
$scope.gotoTask = function(taskId)
|
||||
{
|
||||
$location.path('/tasks/fill/' + taskId);
|
||||
}
|
||||
|
||||
$scope.displayTasks(); // Calling tasks with task id
|
||||
|
||||
|
||||
}]);
|
|
@ -197,8 +197,8 @@ service.factory('apiService', ['$http', function($http) {
|
|||
};
|
||||
return $http(req);
|
||||
},
|
||||
getAllFutureTasks: function(token, courseId){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureCampusTasks/" + token + "/" + courseId;
|
||||
getAllFutureTasks: function(token){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token;
|
||||
req = {
|
||||
method: "GET",
|
||||
url: url
|
||||
|
|
|
@ -25,90 +25,23 @@
|
|||
<md-content>
|
||||
<h1 style="margin-left:15px;"><i class="fa fa-dashboard"></i> Dash Board</h1>
|
||||
</md-content>
|
||||
|
||||
<div layout = "column" flex = 90 layout-margin>
|
||||
<div>
|
||||
Closest Task-
|
||||
<md-card layout-margin layout-padding>
|
||||
<div>
|
||||
In Course: {{tasks[0].courseName}}
|
||||
</div>
|
||||
</md-card>
|
||||
</div>
|
||||
<div>
|
||||
Latest Message-
|
||||
<md-card layout-margin layout-padding>
|
||||
{{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>
|
||||
<div flex = "90">
|
||||
<md-content>
|
||||
<md-tabs md-dynamic-height md-border-bottom>
|
||||
<md-tab label="Messages">
|
||||
<md-content class="tabDesign">
|
||||
<md-content class="messagesContent">
|
||||
<!-- <md-content class="messagesContent"> -->
|
||||
<md-card ng-repeat = "msg in userMessages">
|
||||
<div layout = "column" layout-padding>
|
||||
<div flex = 30 class="md-avatar">
|
||||
<!-- <div> -->
|
||||
<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>
|
||||
{{msg.group.courseName}}
|
||||
<br></br>
|
||||
{{msg.group.projectName}}
|
||||
</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> -->
|
||||
<!-- <div> -->
|
||||
<div flex = "20" layout = "row">
|
||||
<div>
|
||||
{{msg.user.username}}
|
||||
</div>
|
||||
|
@ -117,31 +50,39 @@
|
|||
{{msg.group.projectName}}
|
||||
</div>
|
||||
</div>
|
||||
<div flex = 50 layout-padding>
|
||||
<!-- </div> -->
|
||||
<!-- <div> -->
|
||||
<div flex = "40">
|
||||
{{msg.message}}
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
<!---->
|
||||
|
||||
</md-card>
|
||||
</md-content>
|
||||
<!-- </div> -->
|
||||
</md-content>
|
||||
<!-- </md-content> -->
|
||||
</md-tab>
|
||||
<md-tab label="Tasks">
|
||||
<md-tab label="Tasks waiting for review">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Tasks</h1>
|
||||
<md-card ng-repeat = "task in userTasks" layout-padding>
|
||||
<div>
|
||||
|
||||
Title:
|
||||
<md-button ng-click="gotoTask(task)">
|
||||
{{task.title}}
|
||||
</md-button>
|
||||
<br></br>
|
||||
Description: {{task.description}}
|
||||
</div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<md-tab label="two">
|
||||
<!-- <md-tab label="two">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Tab Two</h1>
|
||||
Two
|
||||
</md-content>
|
||||
</md-tab>
|
||||
</md-tab> -->
|
||||
</md-tabs>
|
||||
</md-content>
|
||||
</div>
|
||||
|
@ -171,75 +112,104 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </md-content> -->
|
||||
</div>
|
||||
<div ng-if="isStudent"> <!-- Student Mode -->
|
||||
<div layout = "column" flex = 90 layout-margin>
|
||||
<div>
|
||||
Closest Task-
|
||||
<md-card layout-margin layout-padding>
|
||||
<div>
|
||||
<md-button ng-click="gotoTask(userTasks[0])">
|
||||
{{userTasks[0].title}}
|
||||
</md-button>
|
||||
</div>
|
||||
</md-card>
|
||||
</div>
|
||||
<div>
|
||||
Latest Message-
|
||||
<md-card layout-margin layout-padding>
|
||||
{{userMessages[0].message}}
|
||||
</md-card>
|
||||
</div>
|
||||
</div>
|
||||
<md-content>
|
||||
<div layout="row">
|
||||
<div flex="65">
|
||||
<md-card>
|
||||
<p class = "messagesFeed">Messages</p>
|
||||
</md-card>
|
||||
<div flex="100">
|
||||
<md-tabs md-dynamic-height md-border-bottom>
|
||||
<md-tab label="Messages">
|
||||
<md-content class="tabDesign">
|
||||
<md-content class="messagesContent">
|
||||
<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="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">
|
||||
<img ng-src="{{user.avatar_url}}" class="roundUserAvatar" style = "width:70%;">
|
||||
</div>
|
||||
<div flex>
|
||||
<div layout = "column">
|
||||
<div flex = "20" layout = "row">
|
||||
<div>
|
||||
<b>{{user.name}}</b>
|
||||
{{msg.user.username}}
|
||||
</div>
|
||||
<div>
|
||||
class_name
|
||||
{{msg.group.courseName}}
|
||||
{{msg.group.projectName}}
|
||||
</div>
|
||||
</div>
|
||||
<div flex = "40">
|
||||
{{msg.message}}
|
||||
</div>
|
||||
</div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
<!-- </div> -->
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<md-tab label="Tasks">
|
||||
<md-content class="md-padding">
|
||||
<md-card ng-repeat = "task in userTasks" layout-padding>
|
||||
<div>
|
||||
<div flex="69" class="msgSent" layout-margin layout-padding>
|
||||
{{msg.text}}
|
||||
</div>
|
||||
</div>
|
||||
Title:
|
||||
<md-button ng-click="gotoTask(task)">
|
||||
{{task.title}}
|
||||
</md-button>
|
||||
<br></br>
|
||||
Description: {{task.description}}
|
||||
</div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<!-- <md-tab label="two">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Tab Two</h1>
|
||||
Two
|
||||
</md-content>
|
||||
</md-tab> -->
|
||||
</md-tabs>
|
||||
</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 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>
|
||||
<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>
|
||||
<div layout-padding layout = "row">
|
||||
<div flex = "60">
|
||||
<md-input-container>
|
||||
<label> Write Your Desired Message Here And Press Post</label>
|
||||
<input type="text" minlength="1" ng-model="msg.msgToAdd" required></input>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div flex = "30">
|
||||
<md-select placeholder="Choose Course" ng-model="courseObj.name" ng-change="chooseCourseClicked()" style="z-index: 300" class="courseDropDown" required>
|
||||
<md-option ng-repeat="c in courses" value="{{c.courseName}}">{{c.courseName}}</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <md-button ng-click="chooseCourseClicked()" ng class="md-raised md-primary">Choose Course</md-button> -->
|
||||
<!-- <md-select placeholder="Choose Course" ng-model="course" ng-click="chooseCourseClicked()" style="z-index: 300"> -->
|
||||
<!-- <md-option ng-switch="user.isLecturer" ng-repeat="c in courses" value="{{c.title}}">{{c.title}}</md-option> -->
|
||||
<!-- </md-select> -->
|
||||
</md-content>
|
||||
</div>
|
||||
</div>
|
|
@ -24,8 +24,13 @@
|
|||
</md-tab>
|
||||
<md-tab label="Not Submitted">
|
||||
<md-content class="md-padding">
|
||||
<h1 class="md-display-2">Not Submitted</h1>
|
||||
<p> Not Submitted ..</p>
|
||||
<md-card ng-repeat = "task in lecturerTasks">
|
||||
<md-button ng-click="gotoTask(task.id)">
|
||||
{{task.title}}
|
||||
</md-button>
|
||||
|
||||
</md-card>
|
||||
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<div ng-if = "user.isLecturer">
|
||||
|
|
Loading…
Reference in a new issue