Make tasks appear on the list when added
This commit is contained in:
@@ -81,6 +81,7 @@ window.onpopstate = function(event)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a task and show it in the #item-details div.
|
* Create a task and show it in the #item-details div.
|
||||||
|
* NOTE: Not used at the moment, we're creating shots via Blender's VSE
|
||||||
*/
|
*/
|
||||||
function shot_create(project_url)
|
function shot_create(project_url)
|
||||||
{
|
{
|
||||||
@@ -105,14 +106,50 @@ function shot_create(project_url)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the task item to the shots/tasks list
|
||||||
|
*/
|
||||||
|
function task_add(shot_id, task_id, project_url, task_type){
|
||||||
|
|
||||||
|
var url = '/attract/' + project_url + '/tasks/' + task_id;
|
||||||
|
|
||||||
|
if (ProjectUtils.context() == 'task'){
|
||||||
|
$('#task-list').append('\
|
||||||
|
<a class="col-list-item task-list-item status-todo task-link"\
|
||||||
|
href="' + url + '"\
|
||||||
|
data-task-id="' + task_id + '"\
|
||||||
|
id="task-' + task_id + '">\
|
||||||
|
<span class="status-indicator"></span>\
|
||||||
|
<span class="name">New Task</span>\
|
||||||
|
<span class="type">none</span>\
|
||||||
|
</a>\
|
||||||
|
');
|
||||||
|
} else if (ProjectUtils.context() == 'shot'){
|
||||||
|
var $shot_cell = $('#shot-' + shot_id + ' .table-cell.task-type.' + task_type);
|
||||||
|
var url = '/attract/' + project_url + '/shots/with-task/' + task_id;
|
||||||
|
|
||||||
|
$shot_cell.append('\
|
||||||
|
<a class="status-todo task-link"\
|
||||||
|
title="New task"\
|
||||||
|
href="' + url + '"\
|
||||||
|
data-task-id="' + task_id + '"\
|
||||||
|
id="task-' + task_id + '">\
|
||||||
|
</a>\
|
||||||
|
');
|
||||||
|
|
||||||
|
$shot_cell.find('.task-add.task-add-link').addClass('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a task and show it in the #item-details div.
|
* Create a task and show it in the #item-details div.
|
||||||
*/
|
*/
|
||||||
function task_create(shot_id, project_url, task_type)
|
function task_create(shot_id, project_url, task_type)
|
||||||
{
|
{
|
||||||
if (shot_id === undefined || project_url === undefined || task_type === undefined) {
|
if (project_url === undefined || task_type === undefined) {
|
||||||
throw new ReferenceError("task_create(" + shot_id + ", " + project_url+ ", " + task_type + ") called.");
|
throw new ReferenceError("task_create(" + project_url+ ", " + task_type + ") called.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = '/attract/' + project_url + '/tasks/create';
|
var url = '/attract/' + project_url + '/tasks/create';
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
@@ -122,6 +159,7 @@ function task_create(shot_id, project_url, task_type)
|
|||||||
|
|
||||||
$.post(url, data, function(task_data) {
|
$.post(url, data, function(task_data) {
|
||||||
task_open(task_data.task_id, project_url);
|
task_open(task_data.task_id, project_url);
|
||||||
|
task_add(shot_id, task_data.task_id, project_url, task_type);
|
||||||
})
|
})
|
||||||
.fail(function(xhr) {
|
.fail(function(xhr) {
|
||||||
if (console) {
|
if (console) {
|
||||||
@@ -129,10 +167,12 @@ function task_create(shot_id, project_url, task_type)
|
|||||||
console.log('XHR:', xhr);
|
console.log('XHR:', xhr);
|
||||||
}
|
}
|
||||||
$('#item-details').html(xhr.responseText);
|
$('#item-details').html(xhr.responseText);
|
||||||
|
})
|
||||||
|
.done(function(){
|
||||||
|
$('#item-details input[name="name"]').focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function attract_form_save(form_id, item_id, item_save_url, options={})
|
function attract_form_save(form_id, item_id, item_save_url, options={})
|
||||||
{
|
{
|
||||||
// Mandatory option.
|
// Mandatory option.
|
||||||
|
@@ -106,7 +106,6 @@ script.
|
|||||||
$('.table-head ' + same_cells).removeClass('highlight');
|
$('.table-head ' + same_cells).removeClass('highlight');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('.table-head .table-cell').mouseenter(function(){
|
$('.table-head .table-cell').mouseenter(function(){
|
||||||
same_cells = '.' + $(this).attr('class').split(' ').join('.');
|
same_cells = '.' + $(this).attr('class').split(' ').join('.');
|
||||||
$('.table-body ' + same_cells).addClass('highlight');
|
$('.table-body ' + same_cells).addClass('highlight');
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
a(href="") Tasks ({{ tasks | count }})
|
a(href="") Tasks ({{ tasks | count }})
|
||||||
a.task-project(href="{{url_for('projects.view', project_url=project.url)}}") {{ project.name }}
|
a.task-project(href="{{url_for('projects.view', project_url=project.url)}}") {{ project.name }}
|
||||||
|
|
||||||
a#task-add(href="javascript:task_create('{{ project.url }}');") + Create Task
|
a#task-add(href="javascript:task_create(undefined, '{{ project.url }}', 'None');") + Create Task
|
||||||
|
|
||||||
#task-list.col-list
|
#task-list.col-list
|
||||||
| {% for task in tasks %}
|
| {% for task in tasks %}
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#item-details
|
#item-details
|
||||||
#task-view
|
#task-view
|
||||||
| {{ tasks | count }} tasks so far.
|
| {{ tasks | count }} tasks so far.
|
||||||
a(href="javascript:task_create('{{ project.url }}');") Create a new one!
|
a(href="javascript:task_create(undefined, '{{ project.url }}', 'None');") Create a new one!
|
||||||
| {% endblock %}
|
| {% endblock %}
|
||||||
|
|
||||||
| {% block footer_scripts %}
|
| {% block footer_scripts %}
|
||||||
|
Reference in New Issue
Block a user