From d3ec3a34e5da7b3de9a2039adca8e491de3aad7c Mon Sep 17 00:00:00 2001 From: sihombing Date: Fri, 13 May 2022 09:28:45 +0000 Subject: [PATCH] cosmetic updates --- .../theme_hft/templates/group/read_base.html | 7 +++++ .../ckanext/theme_hft/templates/header.html | 7 +++-- .../theme_hft/templates/home/layout2.html | 6 ++++ .../templates/home/snippets/search.html | 14 +++++++++ .../templates/home/snippets/stats.html | 16 ++++++++++ .../templates/package/group_list.html | 8 +++++ .../templates/package/read_base.html | 7 +++++ .../snippets/package_basic_fields.html | 8 +++++ .../snippets/package_metadata_fields.html | 14 +++++++++ .../package/snippets/resource_form.html | 8 +++++ .../templates/snippets/activity_stream.html | 19 ++++++++++++ .../templates/snippets/facet_list.html | 17 +++++++++++ .../snippets/most_popular_groups.html | 29 ++++++++++++++++++ .../theme_hft/templates/user/dashboard.html | 12 ++++++++ .../theme_hft/templates/user/read_base.html | 30 +++++++++++++++++++ 15 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/group/read_base.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/home/layout2.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/search.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/stats.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/package/group_list.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/package/read_base.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_basic_fields.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_metadata_fields.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/resource_form.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/snippets/activity_stream.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/snippets/facet_list.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/snippets/most_popular_groups.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/user/dashboard.html create mode 100644 ckanext-theme_hft/ckanext/theme_hft/templates/user/read_base.html diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/group/read_base.html b/ckanext-theme_hft/ckanext/theme_hft/templates/group/read_base.html new file mode 100644 index 0000000..96d9983 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/group/read_base.html @@ -0,0 +1,7 @@ +{% ckan_extends %} + +{# Remove Activity Stream #} +{% block content_primary_nav %} + {{ h.build_nav_icon(group_type + '.read', _('Datasets'), id=group_dict.name, icon='sitemap') }} + {{ h.build_nav_icon(group_type + '.about', _('About'), id=group_dict.name, icon='info-circle') }} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/header.html b/ckanext-theme_hft/ckanext/theme_hft/templates/header.html index df7c8d8..deb2436 100644 --- a/ckanext-theme_hft/ckanext/theme_hft/templates/header.html +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/header.html @@ -1,9 +1,12 @@ {% ckan_extends %} -{# exclude About #} +{# Remove access to Profile Setting #} +{% block header_account_settings_link %} +{% endblock %} + +{# Exclude About and Organizations #} {% block header_site_navigation_tabs %} {{ h.build_nav_main( ('dataset.search', _('Datasets')), - ('organization.index', _('Organizations')), ('group.index', _('Groups')) ) }} {% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/home/layout2.html b/ckanext-theme_hft/ckanext/theme_hft/templates/home/layout2.html new file mode 100644 index 0000000..e435255 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/home/layout2.html @@ -0,0 +1,6 @@ +{% ckan_extends %} + +{% block featured_group %} + {% snippet 'snippets/most_popular_groups.html', + groups=h.hft_theme_most_popular_groups() %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/search.html b/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/search.html new file mode 100644 index 0000000..1274b9d --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/search.html @@ -0,0 +1,14 @@ +{% set placeholder = _('E.g. environment') %} + + diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/stats.html b/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/stats.html new file mode 100644 index 0000000..4b2b877 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/home/snippets/stats.html @@ -0,0 +1,16 @@ +{% ckan_extends %} + + {% block stats_group %} +
  • + + {{ h.SI_number_span(stats.dataset_count) }} + {{ _('dataset') if stats.dataset_count == 1 else _('datasets') }} + +
  • +
  • + + {{ h.SI_number_span(stats.group_count) }} + {{ _('group') if stats.group_count == 1 else _('groups') }} + +
  • + {% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/package/group_list.html b/ckanext-theme_hft/ckanext/theme_hft/templates/package/group_list.html new file mode 100644 index 0000000..594e2a1 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/package/group_list.html @@ -0,0 +1,8 @@ +{% ckan_extends %} + +{% block primary_content_inner %} + {{ super() }} + + {% if (group_dropdown) and (c.userobj) %} + {% endif %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/package/read_base.html b/ckanext-theme_hft/ckanext/theme_hft/templates/package/read_base.html new file mode 100644 index 0000000..92e9214 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/package/read_base.html @@ -0,0 +1,7 @@ +{% ckan_extends %} + +{# Remove Activity Stream #} +{% block content_primary_nav %} + {{ h.build_nav_icon(dataset_type ~ '.read', _('Dataset'), id=pkg.id if is_activity_archive else pkg.name, icon='sitemap') }} + {{ h.build_nav_icon(dataset_type ~ '.groups', _('Groups'), id=pkg.id if is_activity_archive else pkg.name, icon='users') }} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_basic_fields.html b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_basic_fields.html new file mode 100644 index 0000000..ea0c632 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_basic_fields.html @@ -0,0 +1,8 @@ +{% ckan_extends %} + +{% block package_basic_fields_title %} +{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target', 'class': 'form-control'}, is_required=true) }} +{% endblock %} + +{% block package_basic_fields_tags %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_metadata_fields.html b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_metadata_fields.html new file mode 100644 index 0000000..4ef9f4c --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/package_metadata_fields.html @@ -0,0 +1,14 @@ +{% ckan_extends %} + +{% block package_metadata_author %} + {{ form.input('author', label=_('Author'), id='field-author', placeholder=_('Joe Bloggs'), value=data.author, error=errors.author, classes=['control-medium'], is_required=true) }} + {{ form.input('author_email', label=_('Author Email'), id='field-author-email', placeholder=_('joe@example.com'), value=data.author_email, error=errors.author_email, classes=['control-medium'], is_required=true) }} +{% endblock %} + +{% block package_metadata_fields_maintainer %} + {{ form.input('maintainer', label=_('Maintainer'), id='field-maintainer', placeholder=_('Joe Bloggs'), value=data.maintainer, error=errors.maintainer, classes=['control-medium'], is_required=true) }} + {{ form.input('maintainer_email', label=_('Maintainer Email'), id='field-maintainer-email', placeholder=_('joe@example.com'), value=data.maintainer_email, error=errors.maintainer_email, classes=['control-medium'], is_required=true) }} +{% endblock %} + +{% block package_metadata_fields_custom %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/resource_form.html b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/resource_form.html new file mode 100644 index 0000000..5cb72df --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/package/snippets/resource_form.html @@ -0,0 +1,8 @@ +{% ckan_extends %} + +{% block basic_fields_url %} + {% set is_upload = (data.url_type == 'upload') %} + {{ form.image_upload(data, errors, field_url='url', field_upload='upload', field_clear='clear_upload', + is_upload_enabled=h.uploads_enabled(), is_url=data.url and not is_upload, is_upload=is_upload, + upload_label=_('Data (max. 150MB)'), url_label=_('URL'), placeholder=_('http://example.com/external-data.csv'), field_name='name') }} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/activity_stream.html b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/activity_stream.html new file mode 100644 index 0000000..ece09c2 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/activity_stream.html @@ -0,0 +1,19 @@ +{% ckan_extends %} + +{% macro actor(activity) %} +{% endmacro %} + +{% macro dataset(activity) %} +{% endmacro %} + +{% macro organization(activity) %} +{% endmacro %} + +{% macro user(activity) %} +{% endmacro %} + +{% macro group(activity) %} +{% endmacro %} + +{% block activity_stream %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/facet_list.html b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/facet_list.html new file mode 100644 index 0000000..2aa6496 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/facet_list.html @@ -0,0 +1,17 @@ +{% ckan_extends %} +{% block facet_list %} + {# hide empty facet (Organizations and Tags) #} + {% set hide_empty = hide_empty or true %} + {% with items = items or h.get_facet_items_dict(name, search_facets or c.search_facets) %} + {% if items or not hide_empty %} + {% if within_tertiary %} + {% set nav_class = 'nav nav-pills nav-stacked' %} + {% set nav_item_class = ' ' %} + {% set wrapper_class = 'nav-facet nav-facet-tertiary' %} + {% endif %} + {% block facet_list_item %} + {{ super() }} + {% endblock %} + {% endif %} + {% endwith %} +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/most_popular_groups.html b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/most_popular_groups.html new file mode 100644 index 0000000..b425f59 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/snippets/most_popular_groups.html @@ -0,0 +1,29 @@ +{# Renders a list of the site's most popular groups. #} +
    +
    +

    Most popular topics

    +
    +
    +
      + {% for group in groups %} +
    • + +

      {{ group.display_name }}

      +
      + {% if group.description %} +

      + {{ h.markdown_extract(group.description, extract_length=80) }} +

      + {% else %} +

      {{ _('This group has no description') }}

      + {% endif %} + {% if group.package_count %} + {{ ungettext('{num} Dataset', '{num} Datasets', group.package_count).format(num=group.package_count) }} + {% else %} + {{ _('0 Datasets') }} + {% endif %} +
    • + {% endfor %} +
    +
    +
    diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/user/dashboard.html b/ckanext-theme_hft/ckanext/theme_hft/templates/user/dashboard.html new file mode 100644 index 0000000..61b02e7 --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/user/dashboard.html @@ -0,0 +1,12 @@ +{% ckan_extends %} + +{% block page_header %} + +{% endblock %} diff --git a/ckanext-theme_hft/ckanext/theme_hft/templates/user/read_base.html b/ckanext-theme_hft/ckanext/theme_hft/templates/user/read_base.html new file mode 100644 index 0000000..1bbf72b --- /dev/null +++ b/ckanext-theme_hft/ckanext/theme_hft/templates/user/read_base.html @@ -0,0 +1,30 @@ +{% ckan_extends %} + +{# Remove access to see all users #} +{% block breadcrumb_content %} + {{ h.build_nav('user.read', user.display_name|truncate(35), id=user.name) }} +{% endblock %} + +{# Remove access to edit user profile #} +{% block content_action %} +{% endblock %} + +{# Remove user API tokens and Activity Stream #} +{% block content_primary_nav %} + {{ h.build_nav_icon('user.read', _('Datasets'), id=user.name, icon='sitemap') }} +{% endblock %} + +{# Remove biography #} +{% block user_about %} +{% endblock %} + +{% block user_info %} +
    + {% if is_myself %} +
    +
    {{ _('Email') }} {{ _('Private') }}
    +
    {{ user.email }}
    +
    + {% endif %} +
    +{% endblock %} -- GitLab