Added async task loading
This commit is contained in:
@@ -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 %}
|
||||
|
8
src/templates/attract/tasks/view_task_embed.jade
Normal file
8
src/templates/attract/tasks/view_task_embed.jade
Normal file
@@ -0,0 +1,8 @@
|
||||
.task
|
||||
dl
|
||||
dt Name
|
||||
dd {{ task.name }}
|
||||
dt Description
|
||||
dd {{ task.description }}
|
||||
dt Status
|
||||
dd {{ task.properties.status }}
|
Reference in New Issue
Block a user