Changed task route in app js. task fill gets real task
This commit is contained in:
parent
1def744997
commit
ad3a34d6ee
4 changed files with 52 additions and 31 deletions
|
@ -48,11 +48,11 @@ app.config(['$routeProvider', '$locationProvider',
|
|||
templateUrl: 'templates/views/newTask.html',
|
||||
controller: 'newTasksController'
|
||||
})
|
||||
.when('/tasks/overview/:taskId/:submitterId', {
|
||||
.when('/tasks/overview/:taskId/:submitterId/:gId', {
|
||||
templateUrl: 'templates/views/task.html',
|
||||
controller: 'taskController'
|
||||
})
|
||||
.when('/tasks/fill/:taskId', {
|
||||
.when('/tasks/fill/:taskId/:gId', {
|
||||
templateUrl: 'templates/views/task.html',
|
||||
controller: 'taskController'
|
||||
})
|
||||
|
|
|
@ -51,7 +51,7 @@ angular.module('SeHub').controller('newTasksController', ['$scope', 'apiService'
|
|||
console.error(err);
|
||||
})
|
||||
} else {
|
||||
alert('Fill All Shit!');
|
||||
alert('Please Fill All Task info & At least one component');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,8 @@ angular.module('SeHub').controller('newTasksController', ['$scope', 'apiService'
|
|||
return false;
|
||||
if (!$scope.task.date)
|
||||
return false;
|
||||
if ($scope.task.components.length < 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,12 +6,22 @@ angular.module('SeHub')
|
|||
|
||||
var taskId = $routeParams.taskId;
|
||||
var submitterId = $routeParams.submitterId;
|
||||
var token = $cookies['com.sehub.www'];
|
||||
var groupId = $routeParams.gId;
|
||||
|
||||
apiService.getTaskById(token, taskId, groupId).success(function(data){
|
||||
$scope.task = data;
|
||||
$scope.dateInit($scope.task.dueDate);
|
||||
}).error(function(err){
|
||||
console.error('Error: ', err);
|
||||
})
|
||||
|
||||
if (submitterId) { //In This Case we Only Want to show The Content of the Submitter
|
||||
$scope.readOnly = true;
|
||||
|
||||
} else { //In This Case We Need An Empty Task To Be Able To Fill It
|
||||
$scope.readOnly = false;
|
||||
apiService.getTaskById(token, taskId, groupId);
|
||||
}
|
||||
|
||||
$scope.dateInit = function(date) {
|
||||
|
@ -81,35 +91,35 @@ angular.module('SeHub')
|
|||
= Mock Data =
|
||||
=================================*/
|
||||
|
||||
$scope.task = {
|
||||
"title": "task1",
|
||||
"courseId": 1234567890,
|
||||
"description": "one line\nsecondline\nthirdline",
|
||||
"dueDate": {
|
||||
"year": 2010,
|
||||
"month": 2,
|
||||
"day": 4
|
||||
},
|
||||
"isPersonal": true,
|
||||
"components": [{
|
||||
"type": "radiobuttons",
|
||||
"label": "pick One|this|orthis|MaybeThis",
|
||||
"isMandatory": true,
|
||||
"order": 1
|
||||
}, {
|
||||
"type": "checkbox",
|
||||
"label": "tick Me",
|
||||
"isMandatory": true,
|
||||
"order": 2
|
||||
}, {
|
||||
"type": "textarea",
|
||||
"label": "fill shit",
|
||||
"isMandatory": false,
|
||||
"order": 3
|
||||
}]
|
||||
};
|
||||
// $scope.task = {
|
||||
// "title": "task1",
|
||||
// "courseId": 1234567890,
|
||||
// "description": "one line\nsecondline\nthirdline",
|
||||
// "dueDate": {
|
||||
// "year": 2010,
|
||||
// "month": 2,
|
||||
// "day": 4
|
||||
// },
|
||||
// "isPersonal": true,
|
||||
// "components": [{
|
||||
// "type": "radiobuttons",
|
||||
// "label": "pick One|this|orthis|MaybeThis",
|
||||
// "isMandatory": true,
|
||||
// "order": 1
|
||||
// }, {
|
||||
// "type": "checkbox",
|
||||
// "label": "tick Me",
|
||||
// "isMandatory": true,
|
||||
// "order": 2
|
||||
// }, {
|
||||
// "type": "textarea",
|
||||
// "label": "fill shit",
|
||||
// "isMandatory": false,
|
||||
// "order": 3
|
||||
// }]
|
||||
// };
|
||||
|
||||
$scope.dateInit($scope.task.dueDate);
|
||||
|
||||
|
||||
$scope.dueTime = function() {
|
||||
if (!$scope.task.date || $scope.task.date === '')
|
||||
|
|
|
@ -245,6 +245,15 @@ service.factory('apiService', ['$http', function($http) {
|
|||
url: url
|
||||
};
|
||||
return $http(req);
|
||||
},
|
||||
getTaskById: function(token, taskId, ownerId){
|
||||
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getTaskById/" + token + "/" + taskId + "/" + ownerId;
|
||||
var req = {
|
||||
method: 'GET',
|
||||
url: url
|
||||
};
|
||||
return $http(req);
|
||||
|
||||
}
|
||||
};
|
||||
}]);
|
Loading…
Reference in a new issue