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',
|
templateUrl: 'templates/views/newTask.html',
|
||||||
controller: 'newTasksController'
|
controller: 'newTasksController'
|
||||||
})
|
})
|
||||||
.when('/tasks/overview/:taskId/:submitterId', {
|
.when('/tasks/overview/:taskId/:submitterId/:gId', {
|
||||||
templateUrl: 'templates/views/task.html',
|
templateUrl: 'templates/views/task.html',
|
||||||
controller: 'taskController'
|
controller: 'taskController'
|
||||||
})
|
})
|
||||||
.when('/tasks/fill/:taskId', {
|
.when('/tasks/fill/:taskId/:gId', {
|
||||||
templateUrl: 'templates/views/task.html',
|
templateUrl: 'templates/views/task.html',
|
||||||
controller: 'taskController'
|
controller: 'taskController'
|
||||||
})
|
})
|
||||||
|
|
|
@ -51,7 +51,7 @@ angular.module('SeHub').controller('newTasksController', ['$scope', 'apiService'
|
||||||
console.error(err);
|
console.error(err);
|
||||||
})
|
})
|
||||||
} else {
|
} 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;
|
return false;
|
||||||
if (!$scope.task.date)
|
if (!$scope.task.date)
|
||||||
return false;
|
return false;
|
||||||
|
if ($scope.task.components.length < 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,22 @@ angular.module('SeHub')
|
||||||
|
|
||||||
var taskId = $routeParams.taskId;
|
var taskId = $routeParams.taskId;
|
||||||
var submitterId = $routeParams.submitterId;
|
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
|
if (submitterId) { //In This Case we Only Want to show The Content of the Submitter
|
||||||
$scope.readOnly = true;
|
$scope.readOnly = true;
|
||||||
|
|
||||||
} else { //In This Case We Need An Empty Task To Be Able To Fill It
|
} else { //In This Case We Need An Empty Task To Be Able To Fill It
|
||||||
$scope.readOnly = false;
|
$scope.readOnly = false;
|
||||||
|
apiService.getTaskById(token, taskId, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.dateInit = function(date) {
|
$scope.dateInit = function(date) {
|
||||||
|
@ -81,35 +91,35 @@ angular.module('SeHub')
|
||||||
= Mock Data =
|
= Mock Data =
|
||||||
=================================*/
|
=================================*/
|
||||||
|
|
||||||
$scope.task = {
|
// $scope.task = {
|
||||||
"title": "task1",
|
// "title": "task1",
|
||||||
"courseId": 1234567890,
|
// "courseId": 1234567890,
|
||||||
"description": "one line\nsecondline\nthirdline",
|
// "description": "one line\nsecondline\nthirdline",
|
||||||
"dueDate": {
|
// "dueDate": {
|
||||||
"year": 2010,
|
// "year": 2010,
|
||||||
"month": 2,
|
// "month": 2,
|
||||||
"day": 4
|
// "day": 4
|
||||||
},
|
// },
|
||||||
"isPersonal": true,
|
// "isPersonal": true,
|
||||||
"components": [{
|
// "components": [{
|
||||||
"type": "radiobuttons",
|
// "type": "radiobuttons",
|
||||||
"label": "pick One|this|orthis|MaybeThis",
|
// "label": "pick One|this|orthis|MaybeThis",
|
||||||
"isMandatory": true,
|
// "isMandatory": true,
|
||||||
"order": 1
|
// "order": 1
|
||||||
}, {
|
// }, {
|
||||||
"type": "checkbox",
|
// "type": "checkbox",
|
||||||
"label": "tick Me",
|
// "label": "tick Me",
|
||||||
"isMandatory": true,
|
// "isMandatory": true,
|
||||||
"order": 2
|
// "order": 2
|
||||||
}, {
|
// }, {
|
||||||
"type": "textarea",
|
// "type": "textarea",
|
||||||
"label": "fill shit",
|
// "label": "fill shit",
|
||||||
"isMandatory": false,
|
// "isMandatory": false,
|
||||||
"order": 3
|
// "order": 3
|
||||||
}]
|
// }]
|
||||||
};
|
// };
|
||||||
|
|
||||||
$scope.dateInit($scope.task.dueDate);
|
|
||||||
|
|
||||||
$scope.dueTime = function() {
|
$scope.dueTime = function() {
|
||||||
if (!$scope.task.date || $scope.task.date === '')
|
if (!$scope.task.date || $scope.task.date === '')
|
||||||
|
|
|
@ -245,6 +245,15 @@ service.factory('apiService', ['$http', function($http) {
|
||||||
url: url
|
url: url
|
||||||
};
|
};
|
||||||
return $http(req);
|
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