diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index f8768cd760d..ab233f9b79f 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -345,3 +345,10 @@ def resource_link(resource_dict, package_id): resource_id=resource_dict['id']) return link_to(text, url) +def tag_link(tag): + url = url_for(controller='tag', action='read', id=tag['name']) + return link_to(tag['name'], url) + +def group_link(group): + url = url_for(controller='group', action='read', id=group['name']) + return link_to(group['name'], url) diff --git a/ckan/templates/_util.html b/ckan/templates/_util.html index 2d517727200..1c6e7d7bf4e 100644 --- a/ckan/templates/_util.html +++ b/ckan/templates/_util.html @@ -451,4 +451,23 @@ +
+ + ${subject} + + + ${verb} + + + + ${object} + + + + + + ${h.render_datetime(activity.timestamp, '%B %d %Y')} + +
+ diff --git a/ckan/templates/activity_streams/added_tag.html b/ckan/templates/activity_streams/added_tag.html index 6f27f3c7616..f31bb6b792b 100644 --- a/ckan/templates/activity_streams/added_tag.html +++ b/ckan/templates/activity_streams/added_tag.html @@ -6,18 +6,11 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - added - the tag - - ${detail.data.tag.name} - - to the dataset - ${package_summary(detail.data.package)} - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='added', + object=("the tag "+h.tag_link(detail.data.tag)+ + " to the dataset "+h.dataset_link(detail.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/changed_group.html b/ckan/templates/activity_streams/changed_group.html index d6904ad3000..d4963d854af 100644 --- a/ckan/templates/activity_streams/changed_group.html +++ b/ckan/templates/activity_streams/changed_group.html @@ -6,18 +6,10 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - updated - the group - - ${activity.data.group.name} - -
- ${h.truncate(activity.data.group.description, length=80, whole_word=True)} -
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='updated', + object="the group "+h.group_link(activity.data.group), + activity=activity + )} diff --git a/ckan/templates/activity_streams/changed_package.html b/ckan/templates/activity_streams/changed_package.html index 4777baabca8..f132682c793 100644 --- a/ckan/templates/activity_streams/changed_package.html +++ b/ckan/templates/activity_streams/changed_package.html @@ -6,16 +6,9 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - updated - the dataset - ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='updated', + object="the dataset "+h.dataset_link(activity.data.package), + activity=activity)} diff --git a/ckan/templates/activity_streams/changed_package_extra.html b/ckan/templates/activity_streams/changed_package_extra.html index 5f1fafe5e8c..a07fa6add52 100644 --- a/ckan/templates/activity_streams/changed_package_extra.html +++ b/ckan/templates/activity_streams/changed_package_extra.html @@ -6,16 +6,11 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - changed - the extra "${detail.data.package_extra.key}" - in the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='changed', + object=('the extra "'+detail.data.package_extra.key+'" of the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/changed_resource.html b/ckan/templates/activity_streams/changed_resource.html index dcaeca96652..168314ca280 100644 --- a/ckan/templates/activity_streams/changed_resource.html +++ b/ckan/templates/activity_streams/changed_resource.html @@ -6,16 +6,12 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - updated - the resource ${resource_summary(activity.data.package, detail.data.resource)} - in the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='updated', + object=('the resource '+h.resource_link(detail.data.resource, + activity.data.package.id)+' in the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/changed_user.html b/ckan/templates/activity_streams/changed_user.html index feb2afa2464..a2340eab803 100644 --- a/ckan/templates/activity_streams/changed_user.html +++ b/ckan/templates/activity_streams/changed_user.html @@ -6,11 +6,9 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - updated their profile - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='updated their profile.', + activity=activity + )} diff --git a/ckan/templates/activity_streams/deleted_group.html b/ckan/templates/activity_streams/deleted_group.html index 4ad438dc10b..2c20c5a5e19 100644 --- a/ckan/templates/activity_streams/deleted_group.html +++ b/ckan/templates/activity_streams/deleted_group.html @@ -6,15 +6,10 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - deleted - the group ${activity.data.group.name} -
- ${h.truncate(activity.data.group.description, length=80, whole_word=True)} -
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='deleted', + object="the group "+h.group_link(activity.data.group), + activity=activity + )} diff --git a/ckan/templates/activity_streams/deleted_package.html b/ckan/templates/activity_streams/deleted_package.html index 2bdcf300df1..f132682c793 100644 --- a/ckan/templates/activity_streams/deleted_package.html +++ b/ckan/templates/activity_streams/deleted_package.html @@ -6,16 +6,9 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - deleted - the dataset - ${activity.data.package.name} - ${activity.data.package.title} - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='updated', + object="the dataset "+h.dataset_link(activity.data.package), + activity=activity)} diff --git a/ckan/templates/activity_streams/deleted_package_extra.html b/ckan/templates/activity_streams/deleted_package_extra.html index 433a0254500..a6cf932483a 100644 --- a/ckan/templates/activity_streams/deleted_package_extra.html +++ b/ckan/templates/activity_streams/deleted_package_extra.html @@ -6,16 +6,11 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - deleted - the extra "${detail.data.package_extra.key}" - from the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='deleted', + object=('the extra "'+detail.data.package_extra.key+'" from the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/deleted_resource.html b/ckan/templates/activity_streams/deleted_resource.html index 0e2d4b2a77c..77133fe8aa6 100644 --- a/ckan/templates/activity_streams/deleted_resource.html +++ b/ckan/templates/activity_streams/deleted_resource.html @@ -6,16 +6,12 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - deleted - the resource ${h.resource_display_name(detail.data.resource)} - from the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='deleted', + object=('the resource '+h.resource_link(detail.data.resource, + activity.data.package.id)+' from the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/new_group.html b/ckan/templates/activity_streams/new_group.html index d987047f28d..dba6209f8a0 100644 --- a/ckan/templates/activity_streams/new_group.html +++ b/ckan/templates/activity_streams/new_group.html @@ -6,15 +6,10 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - created - the group - - ${activity.data.group.name} - - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='created', + object="the group "+h.group_link(activity.data.group), + activity=activity + )} diff --git a/ckan/templates/activity_streams/new_package.html b/ckan/templates/activity_streams/new_package.html index a29ad669312..6e984dcf5fc 100644 --- a/ckan/templates/activity_streams/new_package.html +++ b/ckan/templates/activity_streams/new_package.html @@ -6,16 +6,9 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - created - the dataset - ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='created', + object="the dataset "+h.dataset_link(activity.data.package), + activity=activity)} diff --git a/ckan/templates/activity_streams/new_package_extra.html b/ckan/templates/activity_streams/new_package_extra.html index 2dba8215343..fce4ff960a3 100644 --- a/ckan/templates/activity_streams/new_package_extra.html +++ b/ckan/templates/activity_streams/new_package_extra.html @@ -6,16 +6,11 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - added - the extra "${detail.data.package_extra.key}" - to the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='added', + object=('the extra "'+detail.data.package_extra.key+'" to the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/new_resource.html b/ckan/templates/activity_streams/new_resource.html index 5f9913388cd..d8031fa6b7d 100644 --- a/ckan/templates/activity_streams/new_resource.html +++ b/ckan/templates/activity_streams/new_resource.html @@ -6,16 +6,12 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - added - the resource ${resource_summary(activity.data.package, detail.data.resource)} - to the dataset ${package_summary(activity.data.package)}
- ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
- ${h.markdown_extract(activity.data.package.notes)} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='added', + object=('the resource '+h.resource_link(detail.data.resource, + activity.data.package.id)+' to the dataset ' + +h.dataset_link(activity.data.package)), + activity=activity + )} diff --git a/ckan/templates/activity_streams/new_user.html b/ckan/templates/activity_streams/new_user.html index 491a488473b..1f1a9f8493d 100644 --- a/ckan/templates/activity_streams/new_user.html +++ b/ckan/templates/activity_streams/new_user.html @@ -6,11 +6,9 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - signed up - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='signed up.', + activity=activity + )} diff --git a/ckan/templates/activity_streams/removed_tag.html b/ckan/templates/activity_streams/removed_tag.html index df59b4386e5..228d99c47b9 100644 --- a/ckan/templates/activity_streams/removed_tag.html +++ b/ckan/templates/activity_streams/removed_tag.html @@ -6,18 +6,11 @@ py:strip="" > -
-
- ${h.linked_user(activity.user_id)} - removed - the tag - - ${detail.data.tag.name} - - from the dataset - ${package_summary(detail.data.package)} - ${h.render_datetime(activity.timestamp, '%B %d %Y')} -
-
+${activity_stream_event( + subject=h.linked_user(activity.user_id), + verb='removed', + object=("the tag "+h.tag_link(detail.data.tag)+ + " from the dataset "+h.dataset_link(detail.data.package)), + activity=activity + )}