Allow task creation with parent.
The parent (shot_id in this case) is passed to the task creation end-point. Also, the task type is now passed as form parameter, rather than on the URL.
This commit is contained in:
@@ -32,13 +32,14 @@ function task_create(shot_id, project_url, task_type) {
|
||||
if (console) console.log("task_create(", shot_id, project_url, task_type, ") called.");
|
||||
return;
|
||||
}
|
||||
var base_url = '/attract/' + project_url + '/tasks/create';
|
||||
var url = '/attract/' + project_url + '/tasks/create';
|
||||
|
||||
if (task_type) {
|
||||
base_url += '/' + task_type;
|
||||
}
|
||||
data = {
|
||||
task_type: task_type,
|
||||
parent: shot_id,
|
||||
};
|
||||
|
||||
$.post(base_url, function(task_data) {
|
||||
$.post(url, data, function(task_data) {
|
||||
task_open(task_data.task_id, project_url);
|
||||
})
|
||||
.fail(function(xhr) {
|
||||
|
@@ -71,10 +71,15 @@ def save(project, task_id):
|
||||
|
||||
|
||||
@perproject_blueprint.route('/create', methods=['POST'])
|
||||
@perproject_blueprint.route('/create/<task_type>', methods=['POST'])
|
||||
@attract_project_view()
|
||||
def create_task(project, task_type=None):
|
||||
task = current_attract.task_manager.create_task(project, task_type=task_type)
|
||||
def create_task(project):
|
||||
|
||||
task_type = request.form['task_type']
|
||||
parent = request.form.get('parent', None)
|
||||
|
||||
task = current_attract.task_manager.create_task(project,
|
||||
task_type=task_type,
|
||||
parent=parent)
|
||||
|
||||
resp = flask.make_response()
|
||||
resp.headers['Location'] = flask.url_for('.view_embed_task',
|
||||
|
Reference in New Issue
Block a user