Skip to content

Commit

Permalink
Merge branch 'canada-v2.9' into feature/view-on-portal-messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
JVickery-TBS authored Sep 1, 2023
2 parents 90e983f + a09c4fd commit b6cc17f
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 22 deletions.
10 changes: 9 additions & 1 deletion ckanext/canada/i18n/ckanext-canada.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ckanext-canada 0.4.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-08-31 15:16+0000\n"
"POT-Creation-Date: 2023-08-31 15:35+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -349,6 +349,14 @@ msgstr ""
msgid "Cannot link files of this type"
msgstr ""

#: ckanext/canada/strings.py:78
msgid "These fields have been removed, click update below to save your changes."
msgstr ""

#: ckanext/canada/strings.py:79
msgid "These fields have been removed."
msgstr ""

#: ckanext/canada/validators.py:120
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
Expand Down
10 changes: 9 additions & 1 deletion ckanext/canada/i18n/en/LC_MESSAGES/ckanext-canada.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: CKAN\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-08-31 15:16+0000\n"
"POT-Creation-Date: 2023-08-31 15:35+0000\n"
"PO-Revision-Date: 2014-01-23 13:04+0000\n"
"Last-Translator: Sean Hammond <[email protected]>\n"
"Language: en\n"
Expand Down Expand Up @@ -353,6 +353,14 @@ msgstr ""
msgid "Cannot link files of this type"
msgstr ""

#: ckanext/canada/strings.py:78
msgid "These fields have been removed, click update below to save your changes."
msgstr "These fields will be removed once you save your changes."

#: ckanext/canada/strings.py:79
msgid "These fields have been removed."
msgstr ""

#: ckanext/canada/validators.py:120
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
Expand Down
12 changes: 11 additions & 1 deletion ckanext/canada/i18n/fr/LC_MESSAGES/ckanext-canada.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-08-31 15:16+0000\n"
"POT-Creation-Date: 2023-08-31 15:35+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n"
Expand Down Expand Up @@ -394,6 +394,16 @@ msgstr "Impossible de téléverser un fichier de ce type"
msgid "Cannot link files of this type"
msgstr "Impossible de donner un lien vers un fichier de ce type"

#: ckanext/canada/strings.py:78
msgid "These fields have been removed, click update below to save your changes."
msgstr ""
"Ces champs seront supprimés une fois que vous aurez sauvegardé "
"vos changements."

#: ckanext/canada/strings.py:79
msgid "These fields have been removed."
msgstr "Ces champs ont été supprimés."

#: ckanext/canada/validators.py:120
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
Expand Down
2 changes: 1 addition & 1 deletion ckanext/canada/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def datastore_delete(up_func, context, data_dict):
if data_dict.get('url_type', None) == 'upload':
return up_func(context, data_dict)

lc = ckanapi.LocalCKAN(username=c.user)
lc = ckanapi.LocalCKAN(username=context['user'])
res_id = data_dict['id'] if 'id' in data_dict.keys() else data_dict['resource_id']
res = lc.action.datastore_search(
resource_id=res_id,
Expand Down
4 changes: 4 additions & 0 deletions ckanext/canada/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@
_("Please upload a file or link to an external resource")
_("Cannot upload files of this type")
_("Cannot link files of this type")

# strings from scheming
_('These fields have been removed, click update below to save your changes.')
_('These fields have been removed.')
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 b6cc17f

Please sign in to comment.