More detailed "verb" for task action logging.
This commit is contained in:
@@ -51,9 +51,14 @@ def index():
|
|||||||
act.project = id_to_proj[act.project]
|
act.project = id_to_proj[act.project]
|
||||||
|
|
||||||
if act.node_type == node_type_task_name:
|
if act.node_type == node_type_task_name:
|
||||||
act.link = url_for('attract.tasks.perproject.view_task',
|
if act.context_object:
|
||||||
project_url=act.project.url,
|
act.link = url_for('attract.shots.perproject.with_task',
|
||||||
task_id=act.object)
|
project_url=act.project.url,
|
||||||
|
task_id=act.object)
|
||||||
|
else:
|
||||||
|
act.link = url_for('attract.tasks.perproject.view_task',
|
||||||
|
project_url=act.project.url,
|
||||||
|
task_id=act.object)
|
||||||
elif act.node_type == node_type_shot_name:
|
elif act.node_type == node_type_shot_name:
|
||||||
act.link = url_for('attract.shots.perproject.view_shot',
|
act.link = url_for('attract.shots.perproject.view_shot',
|
||||||
project_url=act.project.url,
|
project_url=act.project.url,
|
||||||
|
@@ -70,13 +70,28 @@ def fetch_tasks_parent_info(nodes):
|
|||||||
fetch_task_extra_info(node)
|
fetch_task_extra_info(node)
|
||||||
|
|
||||||
|
|
||||||
# Activity logging
|
# ### Activity logging ### #
|
||||||
|
def _parent_name(task):
|
||||||
|
"""Returns 'for shot "shotname"' if the task is attached to the shot."""
|
||||||
|
|
||||||
|
parent = task.get('parent')
|
||||||
|
if not parent:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
nodes_coll = current_app.db()['nodes']
|
||||||
|
shot = nodes_coll.find_one(parent)
|
||||||
|
if shot:
|
||||||
|
return ' for shot "%s"' % shot['name']
|
||||||
|
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
@only_for_task
|
@only_for_task
|
||||||
def activity_after_replacing_task(task, original):
|
def activity_after_replacing_task(task, original):
|
||||||
user_id = pillar.api.utils.authentication.current_user_id()
|
user_id = pillar.api.utils.authentication.current_user_id()
|
||||||
pillar.api.activities.register_activity(
|
pillar.api.activities.register_activity(
|
||||||
user_id,
|
user_id,
|
||||||
'edited task',
|
('edited task "%s"' % task['name']) + _parent_name(task),
|
||||||
'node', task['_id'],
|
'node', task['_id'],
|
||||||
'project', task['project'],
|
'project', task['project'],
|
||||||
task['project'],
|
task['project'],
|
||||||
@@ -87,11 +102,12 @@ def activity_after_replacing_task(task, original):
|
|||||||
@only_for_task
|
@only_for_task
|
||||||
def activity_after_creating_task(task):
|
def activity_after_creating_task(task):
|
||||||
user_id = pillar.api.utils.authentication.current_user_id()
|
user_id = pillar.api.utils.authentication.current_user_id()
|
||||||
|
|
||||||
pillar.api.activities.register_activity(
|
pillar.api.activities.register_activity(
|
||||||
user_id,
|
user_id,
|
||||||
'created a new task',
|
('created a new task "%s"' % task['name']) + _parent_name(task),
|
||||||
'node', task['_id'],
|
'node', task['_id'],
|
||||||
'project', task['project'],
|
'node', task.get('parent'),
|
||||||
task['project'],
|
task['project'],
|
||||||
node_type=task['node_type'],
|
node_type=task['node_type'],
|
||||||
)
|
)
|
||||||
@@ -107,7 +123,7 @@ def activity_after_deleting_task(task):
|
|||||||
user_id = pillar.api.utils.authentication.current_user_id()
|
user_id = pillar.api.utils.authentication.current_user_id()
|
||||||
pillar.api.activities.register_activity(
|
pillar.api.activities.register_activity(
|
||||||
user_id,
|
user_id,
|
||||||
'deleted task',
|
('deleted task "%s"' % task['name']) + _parent_name(task),
|
||||||
'node', task['_id'],
|
'node', task['_id'],
|
||||||
'project', task['project'],
|
'project', task['project'],
|
||||||
task['project'],
|
task['project'],
|
||||||
|
@@ -12,9 +12,6 @@
|
|||||||
| {% include "attract/index_anon_left_column.html" %}
|
| {% include "attract/index_anon_left_column.html" %}
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
.col-md-6
|
.col-md-6
|
||||||
h3 Latest Edit
|
|
||||||
img.img-responsive(src="//placehold.it/500x250")
|
|
||||||
|
|
||||||
.d-activity
|
.d-activity
|
||||||
h3 Activity
|
h3 Activity
|
||||||
|
|
||||||
@@ -23,7 +20,7 @@
|
|||||||
li
|
li
|
||||||
span.date {{ act._created | pretty_date_time }}:
|
span.date {{ act._created | pretty_date_time }}:
|
||||||
a(href="{{ act.link }}")
|
a(href="{{ act.link }}")
|
||||||
| {{ act['actor_user']['full_name'] }} {{ act.verb }} {{ act.object }}
|
| {{ act['actor_user']['full_name'] }} {{ act.verb }}
|
||||||
| {% endfor %}
|
| {% endfor %}
|
||||||
|
|
||||||
h3 Shot statistics
|
h3 Shot statistics
|
||||||
|
Reference in New Issue
Block a user