Skip to content

Commit

Permalink
[#1664] Add group activity stream page
Browse files Browse the repository at this point in the history
You can now see a group's activity stream at /group/activity/GROUP_NAME.

This page is not integrated into the rest of the group pages yet like
the user activity stream page is with the user pages, but can be in
future if we want.

Also remove c.group_activity_stream from the group read context as it's
not used so no need to compute it.
  • Loading branch information
Sean Hammond committed Oct 26, 2012
1 parent fd37c90 commit 9cc0f84
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ckan/config/routing.py
Expand Up @@ -237,7 +237,8 @@ def make_map():
'edit',
'authz',
'delete',
'history'
'history',
'activity',
]))
)
m.connect('group_read', '/group/{id}', action='read')
Expand Down
28 changes: 22 additions & 6 deletions ckan/controllers/group.py
Expand Up @@ -233,12 +233,6 @@ def pager_url(q=None, page=None):
c.facets = {}
c.page = h.Page(collection=[])

# Add the group's activity stream (already rendered to HTML) to the
# template context for the group/read.html template to retrieve later.
c.group_activity_stream = \
get_action('group_activity_list_html')(context,
{'id': c.group_dict['id']})

return render(self._read_template(c.group_dict['type']))

def new(self, data=None, errors=None, error_summary=None):
Expand Down Expand Up @@ -498,6 +492,28 @@ def history(self, id):
return feed.writeString('utf-8')
return render(self._history_template(c.group_dict['type']))

def activity(self, id):
'''Render this group's public activity stream page.'''

context = {'model': model, 'session': model.Session,
'user': c.user or c.author, 'for_view': True}
data_dict = {'id': id}

try:
c.group_dict = get_action('group_show')(context, data_dict)
c.group = context['group']
except NotFound:
abort(404, _('Group not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read group %s') % id)

# Add the group's activity stream (already rendered to HTML) to the
# template context for the group/read.html template to retrieve later.
c.group_activity_stream = get_action('group_activity_list_html')(
context, {'id': c.group_dict['id']})

return render('group/activity_stream.html')

def _render_edit_form(self, fs):
# errors arrive in c.error and fs.errors
c.fieldset = fs
Expand Down
6 changes: 6 additions & 0 deletions ckan/templates/group/activity_stream.html
@@ -0,0 +1,6 @@
{% extends "page.html" %}

{% block primary_content %}
<h2 class="hide-heading">{{ _('Activity Stream') }}</h2>
{{ c.group_activity_stream | safe }}
{% endblock %}

0 comments on commit 9cc0f84

Please sign in to comment.