Show activities on shot page.

This commit is contained in:
2016-10-18 14:50:35 +02:00
parent 612571b4b2
commit 963430e6d9
9 changed files with 85 additions and 50 deletions

View File

@@ -352,6 +352,29 @@ function task_delete(task_id, task_etag, task_delete_url) {
});
}
function load_activities(url)
{
$.get(url)
.done(function(data) {
if(console) console.log('Activities loaded OK');
$('#activities').html(data);
})
.fail(function(xhr) {
if (console) {
console.log('Error fetching activities');
console.log('XHR:', xhr);
}
$('#status-bar').text('Opening 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>');
}
});
}
$(function() {
$("a.shot-link[data-shot-id]").click(function(e) {
e.preventDefault();

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 }}:&nbsp;
| {{ 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

@@ -55,7 +55,10 @@
| {{ shot.properties.trim_start_in_frames }} frames
#item-view-feed
| Activity feed here.
#activities
script.
new Clipboard('.copy-to-clipboard');
var url = "{{ url_for('.activities', project_url=project.url, shot_id=shot['_id']) }}";
load_activities(url); // from 10_tasks.js

View File

@@ -119,22 +119,4 @@ 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>');
}
});
load_activities(url); // from 10_tasks.js