Added activity list on task view

This commit is contained in:
2016-10-12 16:58:42 +02:00
parent 76a4eac145
commit d0bb5aa598
4 changed files with 76 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
.d-activity
| {% if activities['_meta']['total'] %}
h3 Activity
ul
| {% for act in activities['_items'] %}
li
span.date {{ act._created | pretty_date_time }}: 
| {{ act['actor_user']['full_name'] }} {{ act.verb }}
| {% endfor %}
| {% else %}
p.
No activity detected, which is strange, as we also consider creation
to be an activity.
| {% endif %}

View File

@@ -102,12 +102,13 @@
| {% endif %}
#item-view-feed
| Task updated {{ task._updated | pretty_date }}
#activities
| {% if config.DEBUG %}
pre.
{{ task.to_dict() | pprint }}
| {% endif %}
script.
$("#assignees").select2();
@@ -116,3 +117,24 @@ script.
}
new Clipboard('.copy-to-clipboard');
var url = "{{ url_for('.activities', project_url=project.url, task_id=task['_id']) }}";
$.get(url)
.done(function(data) {
if(console) console.log('Activities for task loaded OK');
$('#activities').html(data);
})
.fail(function(xhr) {
if (console) {
console.log('Error fetching activities');
console.log('XHR:', xhr);
}
$('#status-bar').text('Opening task activity log failed.');
if (xhr.status) {
$('#activities').html(xhr.responseText);
} else {
$('#activities').html('<p class="text-danger">Opening activity log failed. There possibly was ' +
'an error connecting to the server. Please check your network connection and ' +
'try again.</p>');
}
});