From 6fb60534d3c3cf7c0b129d1f4d4108cd566bd99c Mon Sep 17 00:00:00 2001 From: AleexGreen Date: Fri, 29 Mar 2024 17:43:10 +0000 Subject: [PATCH 01/13] Adds hx-get and hx-target to activity stream select and pagination --- .../activity/templates/snippets/activity_type_selector.html | 4 ++-- ckanext/activity/templates/snippets/pagination.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ckanext/activity/templates/snippets/activity_type_selector.html b/ckanext/activity/templates/snippets/activity_type_selector.html index fe3abb44790..2d1b35974b2 100644 --- a/ckanext/activity/templates/snippets/activity_type_selector.html +++ b/ckanext/activity/templates/snippets/activity_type_selector.html @@ -14,11 +14,11 @@ {{ _('Activity type') }} - {% for type_ in activity_types %} - diff --git a/ckanext/activity/templates/snippets/pagination.html b/ckanext/activity/templates/snippets/pagination.html index 130522321f0..d0aa4bdc952 100644 --- a/ckanext/activity/templates/snippets/pagination.html +++ b/ckanext/activity/templates/snippets/pagination.html @@ -3,10 +3,10 @@ {% if newer_activities_url or older_activities_url %}
- + {{ _('Newer activities') }} - + {{ _('Older activities') }}
From ddfc6b28616758c1f60d72e6d06d8e07814fd9df Mon Sep 17 00:00:00 2001 From: AleexGreen Date: Mon, 1 Apr 2024 18:34:34 +0000 Subject: [PATCH 03/13] Add changes/8129.feature --- changes/8129.feature | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changes/8129.feature diff --git a/changes/8129.feature b/changes/8129.feature new file mode 100644 index 00000000000..6a0b7530807 --- /dev/null +++ b/changes/8129.feature @@ -0,0 +1,2 @@ +Replace `activity-stream.js` module with htmx on the activity type select element filters. +Use htmx to navigating to newer and older versions of activity stream \ No newline at end of file From 5f77202c8280b53f8c928efabef68ea9c93b3f4e Mon Sep 17 00:00:00 2001 From: AleexGreen Date: Mon, 1 Apr 2024 18:44:12 +0000 Subject: [PATCH 04/13] Initial commit From 86798e8649f12ca610fa262cb37cc160353fe7cd Mon Sep 17 00:00:00 2001 From: Alex Green Date: Sat, 6 Apr 2024 14:44:54 -0400 Subject: [PATCH 05/13] Add changelog removal file --- changes/8129.feature | 4 ++-- changes/8129.removal | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changes/8129.removal diff --git a/changes/8129.feature b/changes/8129.feature index 6a0b7530807..e0a267ea9f7 100644 --- a/changes/8129.feature +++ b/changes/8129.feature @@ -1,2 +1,2 @@ -Replace `activity-stream.js` module with htmx on the activity type select element filters. -Use htmx to navigating to newer and older versions of activity stream \ No newline at end of file +Use htmx on the activity type select element filters. +Use htmx to navigate to newer and older versions of activity stream. \ No newline at end of file diff --git a/changes/8129.removal b/changes/8129.removal new file mode 100644 index 00000000000..89d720ef932 --- /dev/null +++ b/changes/8129.removal @@ -0,0 +1 @@ +Remove `activity-stream.js` module \ No newline at end of file From 082c4aef5f6762202fde62e3752ff02dc7275b30 Mon Sep 17 00:00:00 2001 From: Alex Green Date: Sat, 6 Apr 2024 15:33:29 -0400 Subject: [PATCH 06/13] Change a tag to button tag --- ckanext/activity/templates/snippets/pagination.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ckanext/activity/templates/snippets/pagination.html b/ckanext/activity/templates/snippets/pagination.html index d0aa4bdc952..b4e26f94222 100644 --- a/ckanext/activity/templates/snippets/pagination.html +++ b/ckanext/activity/templates/snippets/pagination.html @@ -3,11 +3,11 @@ {% if newer_activities_url or older_activities_url %} {% endif %} From 9df83dcda0e8f057f267774e117b318b981bfbc9 Mon Sep 17 00:00:00 2001 From: Alex Green Date: Sat, 6 Apr 2024 17:38:04 -0400 Subject: [PATCH 07/13] Use hx-boost instead of hx-get --- ckanext/activity/templates/snippets/pagination.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ckanext/activity/templates/snippets/pagination.html b/ckanext/activity/templates/snippets/pagination.html index b4e26f94222..4b54cc6aa6c 100644 --- a/ckanext/activity/templates/snippets/pagination.html +++ b/ckanext/activity/templates/snippets/pagination.html @@ -2,12 +2,12 @@ {% set class_next = "btn btn-default" if older_activities_url else "btn disabled" %} {% if newer_activities_url or older_activities_url %} - {% endif %} From b8530203b7aee80bfc9063cfaabf93ee2e210c2d Mon Sep 17 00:00:00 2001 From: Alex Green Date: Wed, 24 Apr 2024 23:48:06 +0000 Subject: [PATCH 08/13] Add read_base to group template, call activity_stream snippet from group read_base --- ckan/lib/plugins.py | 10 ++++++++++ .../templates/group/activity_stream.html | 17 +++++------------ ckanext/activity/templates/group/read_base.html | 6 ++++++ .../templates/organization/activity_stream.html | 17 +++++------------ .../templates/organization/read_base.html | 6 ++++++ .../snippets/activity_type_selector.html | 4 ++-- ckanext/activity/views.py | 9 ++++++--- 7 files changed, 40 insertions(+), 29 deletions(-) diff --git a/ckan/lib/plugins.py b/ckan/lib/plugins.py index 0a1809f43a8..40c9d6287d6 100644 --- a/ckan/lib/plugins.py +++ b/ckan/lib/plugins.py @@ -467,6 +467,13 @@ def edit_template(self) -> str: """ return 'group/edit.html' + def activity_read_base_template(self) -> str: + """ + Returns a string representing the location of the template to be + rendered for the activity stream page + """ + return 'group/read_base.html' + def activity_template(self) -> str: """ Returns a string representing the location of the template to be @@ -581,6 +588,9 @@ def edit_template(self) -> str: def activity_template(self) -> str: return 'organization/activity_stream.html' + def activity_template(self) -> str: + return 'organization/read_base.html' + class DefaultTranslation(object): name: str diff --git a/ckanext/activity/templates/group/activity_stream.html b/ckanext/activity/templates/group/activity_stream.html index 0a7484e6c82..42840040a10 100644 --- a/ckanext/activity/templates/group/activity_stream.html +++ b/ckanext/activity/templates/group/activity_stream.html @@ -1,15 +1,8 @@ -{% extends "group/read_base.html" %} +{% if activity_types is defined %} + {% snippet 'snippets/activity_type_selector.html', id=id, activity_type=activity_type, activity_types=activity_types, blueprint='activity.group_activity' %} +{% endif %} -{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %} +{% snippet 'snippets/stream.html', activity_stream=activity_stream, id=id, object_type='group' %} -{% block primary_content_inner %} +{% snippet 'snippets/pagination.html', newer_activities_url=newer_activities_url, older_activities_url=older_activities_url %} - {% if activity_types is defined %} - {% snippet 'snippets/activity_type_selector.html', id=id, activity_type=activity_type, activity_types=activity_types, blueprint='activity.group_activity' %} - {% endif %} - - {% snippet 'snippets/stream.html', activity_stream=activity_stream, id=id, object_type='group' %} - - {% snippet 'snippets/pagination.html', newer_activities_url=newer_activities_url, older_activities_url=older_activities_url %} - -{% endblock %} diff --git a/ckanext/activity/templates/group/read_base.html b/ckanext/activity/templates/group/read_base.html index 03ce862195e..a50cb3a905e 100644 --- a/ckanext/activity/templates/group/read_base.html +++ b/ckanext/activity/templates/group/read_base.html @@ -1,6 +1,12 @@ {% ckan_extends %} +{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %} + {% block content_primary_nav %} {{ super() }} {{ h.build_nav_icon('activity.group_activity', _('Activity Stream'), id=group_dict.name, offset=0, icon='clock') }} {% endblock content_primary_nav %} + +{% block primary_content_inner %} + {% snippet 'group/activity_stream.html', activity_stream=activity_stream, id=id, object_type='group', group_type=group_type, activity_types=activity_types, blueprint='activity.group_activity' %} +{% endblock %} diff --git a/ckanext/activity/templates/organization/activity_stream.html b/ckanext/activity/templates/organization/activity_stream.html index c69b210c020..688fa727561 100644 --- a/ckanext/activity/templates/organization/activity_stream.html +++ b/ckanext/activity/templates/organization/activity_stream.html @@ -1,14 +1,7 @@ -{% extends "organization/read_base.html" %} +{% if activity_types is defined %} + {% snippet 'snippets/activity_type_selector.html', id=id, activity_type=activity_type, activity_types=activity_types, blueprint='activity.organization_activity' %} +{% endif %} -{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %} +{% snippet 'snippets/stream.html', activity_stream=activity_stream, id=id, object_type='organization' %} -{% block primary_content_inner %} - - {% if activity_types is defined %} - {% snippet 'snippets/activity_type_selector.html', id=id, activity_type=activity_type, activity_types=activity_types, blueprint='activity.organization_activity' %} - {% endif %} - - {% snippet 'snippets/stream.html', activity_stream=activity_stream, id=id, object_type='organization', group_type=group_type %} - - {% snippet 'snippets/pagination.html', newer_activities_url=newer_activities_url, older_activities_url=older_activities_url %} -{% endblock %} +{% snippet 'snippets/pagination.html', newer_activities_url=newer_activities_url, older_activities_url=older_activities_url %} \ No newline at end of file diff --git a/ckanext/activity/templates/organization/read_base.html b/ckanext/activity/templates/organization/read_base.html index 2aa814f258f..7558464baae 100644 --- a/ckanext/activity/templates/organization/read_base.html +++ b/ckanext/activity/templates/organization/read_base.html @@ -1,6 +1,12 @@ {% ckan_extends %} +{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} + {% block content_primary_nav %} {{ super() }} {{ h.build_nav_icon('activity.organization_activity', _('Activity Stream'), id=group_dict.name, offset=0, icon='clock') }} {% endblock content_primary_nav %} + +{% block primary_content_inner %} + {% snippet 'organization/activity_stream.html', activity_stream=activity_stream, id=id, object_type='organization', group_type=group_type, activity_types=activity_types, blueprint='activity.organization_activity' %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/activity/templates/snippets/activity_type_selector.html b/ckanext/activity/templates/snippets/activity_type_selector.html index fd294ce8b5c..b2778148a14 100644 --- a/ckanext/activity/templates/snippets/activity_type_selector.html +++ b/ckanext/activity/templates/snippets/activity_type_selector.html @@ -14,11 +14,11 @@ {{ _('Activity type') }}