Skip to content

Commit

Permalink
Add hx-target to pagination buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeexgreeen committed Jun 19, 2024
1 parent fa80307 commit b7dd13e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ckan/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def params(self):
request.args
'''
return cast(flask.Request, self).args
return self.args


def _get_c():
Expand Down Expand Up @@ -327,7 +327,7 @@ def repr_untrusted(danger: Any):
config_declaration = local.config_declaration = Declaration()

# Proxies to already thread-local safe objects
request = cast(flask.Request, CKANRequest(_get_request))
request = CKANRequest(_get_request)
# Provide a `c` alias for `g` for backwards compatibility
g: Any = LocalProxy(_get_c)
c = g
Expand Down
5 changes: 2 additions & 3 deletions ckan/lib/captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import requests

from ckan.common import config
from ckan.types import Request
from ckan.common import config, CKANRequest


def check_recaptcha(request: Request) -> None:
def check_recaptcha(request: CKANRequest) -> None:
'''Check a user's recaptcha submission is valid, and raise CaptchaError
on failure.'''
recaptcha_private_key = config.get('ckan.recaptcha.privatekey')
Expand Down
2 changes: 1 addition & 1 deletion ckan/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get(self) -> str:

def post(self) -> Union[str, Response]:
try:
req: dict[str, Any] = request.form.copy()
req = request.form.copy()
req.update(request.files.to_dict())
data_dict = logic.clean_dict(
dict_fns.unflatten(
Expand Down
10 changes: 9 additions & 1 deletion ckanext/activity/templates/group/activity_stream.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}

{% block primary_content_inner %}
{% snippet 'snippets/activity_stream.html', activity_stream=activity_stream, id=id, object_type='group', group_type=group_type, activity_types=activity_types, blueprint='activity.group_activity' %}
{% snippet 'snippets/activity_stream.html',
activity_stream=activity_stream,
id=id,
object_type='group',
group_type=group_type,
activity_types=activity_types,
blueprint='activity.group_activity',
newer_activities_url=newer_activities_url,
older_activities_url=older_activities_url %}
{% endblock primary_content_inner %}
10 changes: 9 additions & 1 deletion ckanext/activity/templates/organization/activity_stream.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}

{% block primary_content_inner %}
{% snippet 'snippets/activity_stream.html', activity_stream=activity_stream, id=id, object_type='organization', group_type=group_type, activity_types=activity_types, blueprint='activity.organization_activity' %}
{% snippet 'snippets/activity_stream.html',
activity_stream=activity_stream,
id=id,
object_type='organization',
group_type=group_type,
activity_types=activity_types,
blueprint='activity.organization_activity',
newer_activities_url=newer_activities_url,
older_activities_url=older_activities_url %}
{% endblock primary_content_inner %}
10 changes: 9 additions & 1 deletion ckanext/activity/templates/package/activity_stream.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
{% block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}

{% block primary_content_inner %}
{% snippet 'snippets/activity_stream.html', activity_stream=activity_stream, id=id, object_type='package', group_type=group_type, activity_types=activity_types, blueprint='activity.package_activity' %}
{% snippet 'snippets/activity_stream.html',
activity_stream=activity_stream,
id=id,
object_type='package',
group_type=group_type,
activity_types=activity_types,
blueprint='activity.package_activity',
newer_activities_url=newer_activities_url,
older_activities_url=older_activities_url %}
{% endblock primary_content_inner %}
2 changes: 1 addition & 1 deletion ckanext/activity/templates/snippets/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% set class_next = "btn btn-default" if older_activities_url else "btn disabled" %}

{% if newer_activities_url or older_activities_url %}
<div hx-boost="true" id="activity_page_buttons" class="activity_buttons" style="margin-top: 25px;">
<div hx-boost="true" hx-target="closest .module-content" id="activity_page_buttons" class="activity_buttons" style="margin-top: 25px;">
<a href="{{ newer_activities_url }}" class="{{ class_prev }}">
{{ _('Newer activities') }}
</a>
Expand Down

0 comments on commit b7dd13e

Please sign in to comment.