Skip to content

Commit

Permalink
[#256] Remove id from dashboard activity list.
Browse files Browse the repository at this point in the history
* Remove id from the dashboard activity list functions
* If offset is less than 30, show less should link to offset 0.
  • Loading branch information
nigelbabu committed Apr 3, 2013
1 parent 4665000 commit b6ce1c8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ckan/controllers/user.py
Expand Up @@ -573,8 +573,8 @@ def dashboard(self, id=None, offset=0):
context, {'id': c.userobj.id, 'q': q})
c.dashboard_activity_stream_context = self._get_dashboard_context(
filter_type, filter_id, q)
c.dashboard_activity_stream = h.dashboard_activity_stream(
id, filter_type, filter_id, offset)
c.dashboard_activity_stream = h.dashboard_activity_stream(filter_type,
filter_id, offset)

# Mark the user's new activities as old whenever they view their
# dashboard page.
Expand Down
6 changes: 3 additions & 3 deletions ckan/lib/helpers.py
Expand Up @@ -1282,9 +1282,9 @@ def user_in_org_or_group(group_id):
return len(query.all()) != 0


def dashboard_activity_stream(user_id, filter_type=None, filter_id=None,
def dashboard_activity_stream(filter_type=None, filter_id=None,
offset=0):
'''Return the dashboard activity stream of the given user.
'''Return the dashboard activity stream of the current user.
:param user_id: the id of the user
:type user_id: string
Expand Down Expand Up @@ -1312,7 +1312,7 @@ def dashboard_activity_stream(user_id, filter_type=None, filter_id=None,
return action_function(context, {'id': filter_id, 'offset': offset})
else:
return logic.get_action('dashboard_activity_list_html')(
context, {'id': user_id, 'offset': offset})
context, {'offset': offset})


def recently_changed_packages_activity_stream():
Expand Down
6 changes: 2 additions & 4 deletions ckan/logic/action/get.py
Expand Up @@ -2645,12 +2645,10 @@ def dashboard_activity_list_html(context, data_dict):
'''
activity_stream = dashboard_activity_list(context, data_dict)
model = context['model']
user_id = model.User.get(context['user']).id
offset = int(data_dict.get('offset', 0))
extra_vars = {
'controller': 'dashboard',
'action': 'activity',
'id': user_id,
'controller': 'user',
'action': 'dashboard',
'offset': offset,
}
return activity_streams.activity_list_to_html(context, activity_stream,
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/activity_streams/activity_stream_items.html
Expand Up @@ -4,7 +4,7 @@
{% if activities %}
<ul class="activity" data-module="activity-stream" data-module-more="{{ has_more }}" data-module-context="{{ controller }}" data-module-id="{{ id }}" data-module-offset="{{ offset }}">
{% if offset > 0 %}
<li class="load-less"><a href="{{ h.url_for(controller=controller, action=action, id=id, offset=offset-30) }}" class="btn btn-rounded">{{ _('Load less') }}</a></li>
<li class="load-less"><a href="{{ h.url_for(controller=controller, action=action, id=id, offset=(offset-30 if offset-30 > 0 else 0)) }}" class="btn btn-rounded">{{ _('Load less') }}</a></li>
{% endif %}
{% for activity in activities %}
{% if loop.index <= has_more_length %}
Expand Down

0 comments on commit b6ce1c8

Please sign in to comment.