Create Shot workflow

Still needs update on the list
This commit is contained in:
2016-09-23 19:38:57 +02:00
parent 892f5a7360
commit 052344af26
3 changed files with 28 additions and 2 deletions

View File

@@ -105,4 +105,4 @@ def create_shot(project):
project_url=project['url'],
shot_id=shot['_id'])
resp.status_code = 201
return resp
return flask.make_response(flask.jsonify({'shot_id': shot['_id']}), 201)

View File

@@ -132,6 +132,32 @@ window.onpopstate = function(event)
item_open(state.itemId, state.itemType, false);
}
/**
* Create a task and show it in the #item-details div.
*/
function shot_create(project_url)
{
if (project_url === undefined) {
throw new ReferenceError("shot_create(" + project_url+ ") called.");
}
var url = '/attract/' + project_url + '/shots/create';
data = {
project_url: project_url
};
$.post(url, data, function(shot_data) {
shot_open(shot_data.shot_id);
})
.fail(function(xhr) {
if (console) {
console.log('Error creating task');
console.log('XHR:', xhr);
}
$('#item-details').html(xhr.responseText);
});
}
/**
* Create a task and show it in the #item-details div.
*/

View File

@@ -7,7 +7,7 @@
a(href="") Shots ({{ shots | count }})
a.task-project(href="{{url_for('projects.view', project_url=project.url)}}") {{ project.name }}
a#task-add(href="javascript:task_create('{{ project.url }}');") + Create Shot
a#task-add(href="javascript:shot_create('{{ project.url }}');") + Create Shot
.table#shot-list
.table-head