Some task creation fixes
This commit is contained in:
@@ -158,24 +158,29 @@ function task_add(shot_id, task_id, task_type)
|
||||
|
||||
/**
|
||||
* Create a task and show it in the #item-details div.
|
||||
*
|
||||
* 'shot_id' may be undefined, in which case the task will not
|
||||
* be attached to a shot.
|
||||
*/
|
||||
function task_create(shot_id, task_type)
|
||||
{
|
||||
if (shot_id === undefined || task_type === undefined) {
|
||||
if (task_type === undefined) {
|
||||
throw new ReferenceError("task_create(" + shot_id + ", " + task_type + ") called.");
|
||||
}
|
||||
|
||||
var project_url = ProjectUtils.projectUrl();
|
||||
var url = '/attract/' + project_url + '/tasks/create';
|
||||
var has_shot_id = typeof shot_id !== 'undefined';
|
||||
|
||||
data = {
|
||||
task_type: task_type,
|
||||
parent: shot_id,
|
||||
};
|
||||
if (has_shot_id) data.parent = shot_id;
|
||||
|
||||
|
||||
$.post(url, data, function(task_data) {
|
||||
task_open(task_data.task_id);
|
||||
task_add(shot_id, task_data.task_id, task_type);
|
||||
if (has_shot_id) task_add(shot_id, task_data.task_id, task_type);
|
||||
})
|
||||
.fail(function(xhr) {
|
||||
if (console) {
|
||||
|
Reference in New Issue
Block a user