Skip to content

Commit

Permalink
chore: fix htmx sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Jan 8, 2024
1 parent 6dc1253 commit ee5c7ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
{% set sort_name = collection.name ~ ":sort" %}
{% set sort_value = collection.params.sort %}

{% block table %}
<input name="{{ sort_name }}" type="hidden" value="{{ sort_value }}" form="{{ collection.serializer.form_id }}"/>
{{ super() }}
{% endblock table %}

{% block header %}

<tr class="collection-table--row collection-table--header">
<input name="{{ sort_name }}" type="hidden" value="{{ sort_value }}" form="{{ collection.serializer.form_id }}"/>

{% for col in collection.columns.names if col in collection.columns.visible %}
{% set is_sortable = col in collection.columns.sortable %}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/collection/utils/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def table_id(self):
return f"{self.prefix}-id--{self.attached.name}"


class HtmxTableSerializer(HtmlSerializer[types.TDataCollection]):
class HtmxTableSerializer(TableSerializer[types.TDataCollection]):
"""Serialize collection into HTML table."""

main_template: str = shared.configurable_attribute(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ckanext-collection
version = 0.1.0a7
version = 0.1.0a8
description =
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down

0 comments on commit ee5c7ce

Please sign in to comment.