Added async task loading

This commit is contained in:
2016-09-07 15:08:49 +02:00
parent 805f56d6f4
commit 3c09586349
3 changed files with 55 additions and 15 deletions

View File

@@ -10,12 +10,38 @@
.page-triplet-container.homepage
.row
.col-md-4
h2 The edit
p one column
p hey, here's a column too!
.col-md-4
h2 Tasks
a(href="{{ url_for('attract.tasks.index') }}") Go to task manager
ul
| {% for task in tasks %}
li
a(href="javascript:open_task('{{ task._id }}');") {{ task.name }}
| {% endfor %}
.col-md-4
h2 Other stuff
p three column
#task-details
| {% endblock %}
| {% block footer_scripts %}
script.
/**
* Shows a task in the #task-details div.
*/
function open_task(task_id) {
if (task_id === undefined) {
if (console) console.log("open_task(undefined) called.");
return;
}
var base_url = "{{ url_for('attract.tasks.view_embed_task', project_url=project.url, task_id='TASKID') }}";
var task_url = base_url.replace("TASKID", task_id);
$.get(task_url, function(task_data) {
$('#task-details').html(task_data);
}).fail(function(xhr) {
if (console) {
console.log('Error fetching task', task_id, 'from', task_url);
console.log('XHR:', xhr);
}
$('#task-details').html(xhr.responseText);
});
}
| {% endblock %}

View File

@@ -0,0 +1,8 @@
.task
dl
dt Name
dd {{ task.name }}
dt Description
dd {{ task.description }}
dt Status
dd {{ task.properties.status }}