From 7800698040154776591b88f1ecf58f7c2e4c7cca Mon Sep 17 00:00:00 2001 From: toavina Date: Thu, 10 Oct 2024 18:18:30 +0300 Subject: [PATCH] apply styling --- ckanext/zarr/assets/css/zarr.css | 3 +++ ckanext/zarr/helpers.py | 2 +- ckanext/zarr/templates/package/base.html | 6 +++--- .../zarr/templates/snippets/package_item.html | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 ckanext/zarr/templates/snippets/package_item.html diff --git a/ckanext/zarr/assets/css/zarr.css b/ckanext/zarr/assets/css/zarr.css index b31d5d3..2c70633 100644 --- a/ckanext/zarr/assets/css/zarr.css +++ b/ckanext/zarr/assets/css/zarr.css @@ -361,3 +361,6 @@ margin-right: 5px; } +.dataset-content > h2.dataset-heading > span.badge:not(:first-of-type) { + margin-left: 5px !important; +} \ No newline at end of file diff --git a/ckanext/zarr/helpers.py b/ckanext/zarr/helpers.py index 9757e8c..17b55fb 100644 --- a/ckanext/zarr/helpers.py +++ b/ckanext/zarr/helpers.py @@ -125,7 +125,7 @@ def get_dataset_resource_type_groups(id, dataset_type='dataset'): choices = field['choices'] if choices: return [ - choice['label'] + {'label':choice['label'], 'value':choice['value']} for choice in choices if choice['value'] in groups ] diff --git a/ckanext/zarr/templates/package/base.html b/ckanext/zarr/templates/package/base.html index a3b99fe..2705cef 100644 --- a/ckanext/zarr/templates/package/base.html +++ b/ckanext/zarr/templates/package/base.html @@ -42,9 +42,9 @@

{% link_for pkg.title, named_route=pkg.type ~ '.read', id=p {{ _('Private') }} {% endif %} - {% set resource_type_labels = h.get_dataset_resource_type_groups(pkg.id) %} - {% for label in resource_type_labels %} - {{ label }} + {% set resource_types = h.get_dataset_resource_type_groups(pkg.id) %} + {% for type in resource_types %} + {{ _(type['label']) }} {% endfor %}
{%- set notes = h.render_markdown(h.get_translated(pkg, 'notes')) -%} diff --git a/ckanext/zarr/templates/snippets/package_item.html b/ckanext/zarr/templates/snippets/package_item.html new file mode 100644 index 0000000..67949f2 --- /dev/null +++ b/ckanext/zarr/templates/snippets/package_item.html @@ -0,0 +1,17 @@ +{% ckan_extends %} + + +{% block heading %} +

+ + {{title|truncate(80)}} + + {% set resource_types = h.get_dataset_resource_type_groups(package.id) %} + {% for type in resource_types %} + {{ _(type['label']) }} + {% endfor %} +

+
+ {{_('Modified')}} {{ h.time_ago_from_timestamp(package.metadata_modified) }}, {{ h.get_last_modifier(package.id) }} +
+{% endblock %} \ No newline at end of file