Skip to content

Commit

Permalink
feat(templates): PD activity, and general archives;
Browse files Browse the repository at this point in the history
- Improved PD activity templates.
- Improved archive view templates.
  • Loading branch information
JVickery-TBS committed Sep 1, 2023
1 parent c952c85 commit e1a26a2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
8 changes: 6 additions & 2 deletions ckanext/canada/templates/internal/package/read_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
{% endblock %}

{% block content_primary_nav %}
{{ h.build_nav_icon(pkg.type + '.read', _('Dataset'), id=pkg.name) }}
{{ h.build_nav_icon('dataset.activity', _('Activity Stream'), id=pkg.name) }}
{% set dataset_label = _('Dataset') %}
{% if pkg.type in h.recombinant_get_types() %}
{% set dataset_label = _(pkg.title) %}
{% endif %}
{{ h.build_nav_icon(pkg.type + '.read', dataset_label, id=pkg.name) }}
{{ h.build_nav_icon(pkg.type + '.activity', _('Activity Stream'), id=pkg.name) }}
{% endblock %}
4 changes: 2 additions & 2 deletions ckanext/canada/templates/public/package/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{% set client_lang = h.lang() %}

{% block breadcrumb_content %}
{% set pkg_url = h.url_for(pkg.type ~ '.read', id=pkg.id if is_activity_archive else pkg.name) %}
{% set pkg_url = h.url_for(pkg.type ~ '.read', id=pkg.id if is_activity_archive else pkg.name, **({'activity_id': request.args['activity_id']} if 'activity_id' in request.args else {})) %}
{% if c.action != 'new' and pkg %}
{% set dataset = h.get_translated(pkg, 'title') %}
<li>{% link_for dataset|truncate(30), named_route=pkg.type ~ '.read', id=pkg.id if is_activity_archive else pkg.name %}</li>
<li><a href="{{ pkg_url }}">{{ dataset|truncate(30) }}</a></li>
{% endif %}
{% endblock %}

19 changes: 9 additions & 10 deletions ckanext/canada/templates/public/package/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ <h1>{{ title or pkg.name }}
<i class="fa fa-language text-muted mrgn-lft-sm" title="{{ _("This third party metadata element has been translated using an automated translation tool. To report any discrepancies please contact [email protected]") }}"></i>
{% endif %}
</h1>
{% if is_activity_archive %}
<div class="module-alert alert alert-danger mrgn-tp-sm">
<p>
{% trans url = h.url_for(pkg.type + '.read', id=pkg.id) %}You're currently viewing an old version of this dataset. Some resources may no longer exist or the dataset may not display correctly. To see the current version, click <a href="{{ url }}">here</a>.{% endtrans %}
</p>
</div>
{% endif %}
{% endblock %}

{% block primary_content_inner %}
{% if not c.is_activity_archive %}
{% if not is_activity_archive %}
{%- snippet 'package/snippets/schemaorg.html', data=pkg -%}
{% endif %}
<div class="module">
{% block internal_actions %}{% endblock %}

{% block package_archive_notice %}
{% if c.is_activity_archive %}
<div class="alert alert-error">
<p>
{% trans url = h.url_for(pkg.type + '.read', id=pkg.id) %}You're currently viewing an old version of this dataset. Some resources may no longer exist or the dataset may not display correctly. To see the current version, click <a href="{{ url }}">here</a>.{% endtrans %}
</p>
</div>
{% endif %}
{% endblock %}
{% block package_archive_notice %}{% endblock %}

{% block package_item_title %}
<section class="module-content indent-large">
Expand Down
4 changes: 2 additions & 2 deletions ckanext/canada/templates/public/package/read_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@
{{ _('Link to JSON format') }}
</a>
</li>
{% if h.plugin_loaded('dcat_json_interface') %}
{% if h.plugin_loaded('dcat_json_interface') and pkg.type not in h.recombinant_get_types() %}
<li class="list-group-item" style="border: none;">
<a href="{{ h.url_for(pkg.type + '.read', id=pkg.id) }}.jsonld" rel="nofollow">
{{ _('DCAT (JSON-LD)') }}
</a>
</li>
{% endif %}
{% if h.plugin_loaded('dcat') %}
{% if h.plugin_loaded('dcat') and pkg.type not in h.recombinant_get_types() %}
<li class="list-group-item" style="border: none;">
<a href="{{ h.url_for(pkg.type + '.read', id=pkg.id) }}.xml" rel="nofollow">
{{ _('DCAT (XML)') }}
Expand Down
11 changes: 11 additions & 0 deletions ckanext/canada/templates/public/package/resource_read.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

{% block page_title %}
{{ super() }}
{% if is_activity_archive %}
<div class="module-alert alert alert-danger mrgn-tp-sm">
<p>
{% trans url = h.url_for(pkg.type + '.read', id=pkg.id) %}You're currently viewing an old version of this dataset. Some resources may no longer exist or the dataset may not display correctly. To see the current version, click <a href="{{ url }}">here</a>.{% endtrans %}
</p>
</div>
{% endif %}
{% if h.is_registry() %}
{{ h.get_validation_badge(res)|safe }}
{% endif %}
Expand All @@ -11,6 +18,10 @@
<div class="resource-actions-toolbar">{{ super() }}</div>
{% endblock %}

{% block action_manage %}
{% if not is_activity_archive %}{{ super() }}{% endif %}
{% endblock %}

{% block resource_content %}
{% block resource_read_title %}{{ super() }}{% endblock %}
{% block resource_read_url %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
{%- if machine_translated -%}
<i class="fa fa-language text-muted" style="margin-left: 10px;" title="{{ _("This third party metadata element has been translated using an automated translation tool. To report any discrepancies please contact [email protected]") }}"></i>
{%- endif -%}
{{ h.popular('views', res.tracking_summary.total, min=10) }}
{% if 'tracking_summary' in res %}
{{ h.popular('views', res.tracking_summary.total, min=10) }}
{% endif %}
</a>
{% set language_options = h.scheming_get_preset('canada_resource_language').choices %}
<div>
Expand Down Expand Up @@ -74,7 +76,7 @@
</a>
</li>
{% endif %}
{% if can_edit %}
{% if can_edit and not is_activity_archive %}
<li>{% link_for _('Edit resource'), named_route=pkg.type ~ '_resource.edit', id=pkg.name, resource_id=res.id, class_='dropdown-item', icon='pencil' %}</li>
{% block resource_item_explore_inner scoped %}{% endblock %}
<li>{% link_for _('Views'), named_route=pkg.type ~ '_resource.views', id=pkg.name, resource_id=res.id, class_='dropdown-item', icon='chart-bar' %}
Expand Down

0 comments on commit e1a26a2

Please sign in to comment.