feature: change template files according to template 2.6 (safe)

This commit is contained in:
Alessio Fabrizio 2024-11-13 15:52:11 +01:00
parent a9dd3266cd
commit 610736b1c0
8 changed files with 363 additions and 161 deletions

View File

@ -1,21 +1,24 @@
{% extends "package/read_base.html" %} {% ckan_extends %}
{% set dataset_extent = h.get_pkg_dict_extra(c.pkg_dict, 'spatial', '') %}
{% set d4science_cms_obj_placeholders = h.d4science_get_content_moderator_system_placeholder() %}
{% set moderation_item_status = h.get_pkg_dict_extra(c.pkg_dict,d4science_cms_obj_placeholders.item_status,'') %}
{% block primary_content_inner %} {% block primary_content_inner %}
{{ super() }} {% if moderation_item_status %}
{% set dataset_extent = h.get_pkg_dict_extra(c.pkg_dict, 'spatial', '') %} <span class="label pull-right" style='margin-left:5px; padding:3px;'>
{% if dataset_extent %} {{ moderation_item_status }}
{% snippet "spatial/snippets/dataset_map.html", extent=dataset_extent %} </span>
{% endif %} {% endif %}
{% block package_description %} {% block package_description %}
{% if pkg.private %} {% if pkg.private %}
<span class="dataset-private badge badge-inverse pull-right"> <span class="dataset-private label label-inverse pull-right">
<i class="fa fa-lock"></i> <i class="icon-lock"></i>
{{ _('Private') }} {{ _('Private') }}
</span> </span>
{% endif %} {% endif %}
<h1> <div class="principaltitle">
{% block page_heading %} {% block page_heading %}
{{ h.dataset_display_name(pkg) }} {{ pkg.title or pkg.name }}
{% if pkg.state.startswith('draft') %} {% if pkg.state.startswith('draft') %}
[{{ _('Draft') }}] [{{ _('Draft') }}]
{% endif %} {% endif %}
@ -23,28 +26,34 @@
[{{ _('Deleted') }}] [{{ _('Deleted') }}]
{% endif %} {% endif %}
{% endblock %} {% endblock %}
</h1> </div>
{% block package_notes %} {% block package_notes %}
{% if pkg.notes %} {% if pkg.notes %}
<div class="notes embedded-content"> <div class="notes embedded-content" style="white-space:pre-line;">
{{ h.render_markdown(h.get_translated(pkg, 'notes')) }} {{ h.render_markdown(pkg.notes) }}
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{# FIXME why is this here? seems wrong #} {# FIXME why is this here? seems wrong #}
<span class="insert-comment-thread"></span> <span class="insert-comment-thread"></span>
{% endblock %} {% endblock %}
{% if dataset_extent %}
{% snippet "spatial/snippets/dataset_map.html", extent=dataset_extent %}
{% endif %}
{% block package_tags %}
<div class="sectiontitle">{{_('Tags')}}</div>
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
{% endblock %}
{% block package_resources %} {% block package_resources %}
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
{% endblock %} {% endblock %}
{% block package_tags %}
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
{% endblock %}
{% block package_additional_info %} {% block package_additional_info %}
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %} {% snippet "package/snippets/additional_info.html", pkg_dict=pkg %}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}

View File

@ -1,5 +1,74 @@
{% set key_item_url = _('Item') + ' URL' %}
<script type="text/javascript" src="/fanstatic/d4science_theme/d4science_scripts.js"></script>
<script>
//ADDED by Francesco Mangiacrapa
jsonToHTML = function(containerID, cssClassToTable) {
CKAN_D4S_JSON_Util.jsonToHTML(containerID, cssClassToTable);
}
</script>
<section class="additional-info"> <section class="additional-info">
<h3>{{ _('Additional Info') }}</h3> {% block extras scoped %}
{#
This performs a sort
{% for extra in h.sorted_extras(pkg_dict.extras) %}
#}
{% if pkg_dict.extras %}
{# Added by Francesco Mangiacrapa, see 17901 #}
{% set extra_item_url = h.get_pkg_dict_extra(pkg_dict,key_item_url) %}
{% if extra_item_url %}
<div><div class="sectiontitle">{{ key_item_url }}</div>
<table class="qr-code-table">
<tr>
<td><a href={{ extra_item_url }} target="_blank">{{ extra_item_url }}</a></td>
<td>{% snippet "package/snippets/qrcode_show.html", package_url=extra_item_url %}</td>
</tr>
</table></div>
{% endif %}
{% set extras_indexed_for_categories = h.d4science_get_extras_indexed_for_namespaces(pkg_dict.extras) %}
{% for k_cat in extras_indexed_for_categories %}
{% set category_idx = extras_indexed_for_categories[k_cat] %}
{% if(k_cat!='nocategory') %}
<div><div class="sectiontitle">{{category_idx.category.title}}</div>
{% if category_idx.category.description %}
<div class="notes embedded-content"><p>Description: {{category_idx.category.description}}</p></div>
{% endif %}
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th scope="col">{{ _('Field') }}</th>
<th scope="col">{{ _('Value') }}</th>
</tr>
</thead>
<tbody>
{% set my_extras = h.d4science_get_extra_for_category(extras_indexed_for_categories, k_cat) %}
{% snippet "package/snippets/extras_table.html", my_extras=my_extras, key_item_url=key_item_url %}
</tbody>
</table>
</div>
{% endif %}
{% endfor %}
{% set my_extras = h.d4science_get_extra_for_category(extras_indexed_for_categories, 'nocategory') %}
{% if my_extras|length > 0 %}
<div><div class="sectiontitle">{{ _('Additional Info') }}</div>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th scope="col">{{ _('Field') }}</th>
<th scope="col">{{ _('Value') }}</th>
</tr>
</thead>
<tbody>
{% snippet "package/snippets/extras_table.html", my_extras=my_extras, key_item_url=key_item_url %}
</tbody>
</table>
</div>
{% endif %}
{% endif %}
{% endblock %}
<div class="sectiontitle">{{ _('Management Info') }}</div>
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
@ -13,11 +82,7 @@
<tr> <tr>
<th scope="row" class="dataset-label">{{ _('Source') }}</th> <th scope="row" class="dataset-label">{{ _('Source') }}</th>
{% if h.is_url(pkg_dict.url) %} {% if h.is_url(pkg_dict.url) %}
<td class="dataset-details" property="foaf:homepage"> <td class="dataset-details" property="foaf:homepage">{{ h.link_to(pkg_dict.url, pkg_dict.url, rel='foaf:homepage', target='_blank') }}</td>
<a href="{{ pkg_dict.url }}" rel="foaf:homepage" target="_blank">
{{ pkg_dict.url }}
</a>
</td>
{% else %} {% else %}
<td class="dataset-details" property="foaf:homepage">{{ pkg_dict.url }}</td> <td class="dataset-details" property="foaf:homepage">{{ pkg_dict.url }}</td>
{% endif %} {% endif %}
@ -35,16 +100,17 @@
<td class="dataset-details" property="dc:creator">{{ pkg_dict.author }}</td> <td class="dataset-details" property="dc:creator">{{ pkg_dict.author }}</td>
</tr> </tr>
{% endif %} {% endif %}
{# Added by Francesco Mangiacrapa #}
{% set user_maintainer = h.d4science_get_user_info(pkg_dict.maintainer) %}
{% if pkg_dict.maintainer_email %} {% if pkg_dict.maintainer_email %}
<tr> <tr>
<th scope="row" class="dataset-label">{{ _('Maintainer') }}</th> <th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
<td class="dataset-details" property="dc:contributor">{{ h.mail_to(email_address=pkg_dict.maintainer_email, name=pkg_dict.maintainer) }}</td> <td class="dataset-details" property="dc:contributor">{{ h.mail_to(email_address=pkg_dict.maintainer_email, name=user_maintainer.fullname if (user_maintainer and user_maintainer.fullname) else pkg_dict.maintainer) }}</td>
</tr> </tr>
{% elif pkg_dict.maintainer %} {% elif pkg_dict.maintainer %}
<tr> <tr>
<th scope="row" class="dataset-label">{{ _('Maintainer') }}</th> <th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
<td class="dataset-details" property="dc:contributor">{{ pkg_dict.maintainer }}</td> <td class="dataset-details" property="dc:contributor">{{ user_maintainer.fullname if (user_maintainer and user_maintainer.fullname) else pkg_dict.maintainer }}</td>
</tr> </tr>
{% endif %} {% endif %}
@ -78,18 +144,7 @@
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
</tbody>
{% block extras scoped %}
{% for extra in h.sorted_extras(pkg_dict.extras) %}
{% set key, value = extra %}
<tr rel="dc:relation" resource="_:extra{{ i }}">
<th scope="row" class="dataset-label" property="rdfs:label">{{ _(key|e) }}</th>
<td class="dataset-details" property="rdf:value">{{ value }}</td>
</tr>
{% endfor %}
{% endblock %}
{% endblock %}
</tbody>
</table> </table>
</section> {% endblock %}
</section>

View File

@ -0,0 +1,59 @@
<!-- Applying "Show more"/"Show less" to 'spatial field', see #23298 -->
<script type="text/javascript">
function manageLongField(containerID, n) {
try {
var str = document.getElementById(containerID).innerHTML;
if (str && str.length <= n) {
return str;
}
var newContent = "<div><input type='checkbox' class='read-more-state' id='post-"+containerID+"'' /><label for='post-"+containerID+"'' class='read-more-trigger'></label><p class='read-more-wrap'>";
newContent += str.substring(0, n);
newContent += "<span class='read-more-target'>";
newContent += str.substring(n, str.length);
newContent += "</span></p></div>"
document.getElementById(containerID).innerHTML = newContent
} catch (e) {
console.log('invalid containerID ' + containerID, e);
}
}
</script>
<!-- reading placeholder used by D4Science Content Moderator System, see #22854 -->
{% set d4science_cms_obj_placeholders = h.d4science_get_content_moderator_system_placeholder() %}
{% for extra_lnk in my_extras %}
{% set index = loop.index %}
{% for k in extra_lnk.keys() %}
{# Added by Francesco Mangiacrapa, see: #21701 #}
{% set extra_value = extra_lnk[k] %}
<!-- showing only extra fields with no empty values -->
{% if extra_value is defined and extra_value|length %}
{# Added by Francesco Mangiacrapa, see: #7055 #}
{% set isHttp = extra_value.startswith(('http://', 'https://')) %}
<tr rel="dc:relation" resource="_:extra{{ i }}">
<!-- no showing ITEM URL and D4Science CMS fields into table -->
{% if k != key_item_url and (not k.startswith(d4science_cms_obj_placeholders.prefix)) %}
<th scope="row" class="dataset-label" property="rdfs:label">{{ _(k) }}</th>
{% if isHttp %}
{% if k == 'graphic-preview-file'%}
<td class="dataset-details" property="rdf:value"><img src={{ extra_value }} alt={{ extra_value }}></td>
{% else %}
<td class="dataset-details" property="rdf:value"><a href={{ extra_value }} target="_blank">{{ extra_value }}</a></td>
{% endif %}
{% elif k == 'responsible-party' %}
<td class="dataset-details" property="rdf:value"><div id="responsible-party-extra-{{index}}" class="d4s-json-table">{{ extra_value }}</div><script>jsonToHTML('responsible-party-extra-{{index}}')</script></td>
{% elif k == 'dataset-reference-date' %}
<td class="dataset-details" property="rdf:value"><div id="dataset-reference-date-extra-{{index}}" class="d4s-json-table">{{ extra_value }}</div><script>jsonToHTML('dataset-reference-date-extra-{{index}}')</script></td>
{% elif k == 'coupled-resource' %}
<td class="dataset-details" property="rdf:value"><div id="coupled-resource-date-extra-{{index}}" class="d4s-json-table">{{ extra_value }}</div><script>jsonToHTML('coupled-resource-date-extra-{{index}}')</script></td>
{% elif k.startswith('Zenodo') %}
<td class="dataset-details" property="rdf:value"><div id="related-identifier-extra-{{index}}" class="d4s-json-table">{{ extra_value }}</div><script>jsonToHTML('related-identifier-extra-{{index}}')</script></td>
{% elif k == 'spatial' %}
<td class="dataset-details" property="rdf:value"><div id='spatial-{{index}}'>{{ extra_value }}</div><script>manageLongField('spatial-{{index}}', 150)</script></td>
{% else %}
<td class="dataset-details" property="rdf:value">{{ extra_value }}</td>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}

View File

@ -1,41 +1,48 @@
{# {#
Displays a sidebar module with information for given package Displays a sidebard module with information for given package
pkg - The package dict that owns the resources. pkg - The package dict that owns the resources.
Example: Example:
{% snippet "package/snippets/info.html", pkg=pkg %} {% snippet "package/snippets/info.html", pkg=pkg %}
#} #}
{% block package_info %} {% block package_info %}
{% if pkg %} {% if pkg %}
<section class="module module-narrow"> <section class="module module-narrow">
<div class="module context-info"> <div class="module context-info">
<div class="module-content"> <div class="module-content">
{% block package_info_inner %} {% block package_info_inner %}
{% block heading %} {% block heading %}
<h1 class="heading">{{ h.dataset_display_name(pkg) }}</h1> <div class="infotitle">{{ h.dataset_display_name(pkg) }}</div>
{% endblock %} {% endblock %}
{% block nums %} {% if pkg.extras %}
{% set num_followers = h.follow_count('dataset', pkg.id) %} {% for extra in pkg.extras if extra['key'] == 'graphic-preview-file' %}
<div class="nums"> <div class="graphic-preview-style">
<dl> <div><a href={{ extra['value'] }} target="_blank"><img src={{ extra['value'] }} alt='graphic-preview-file'>Show Graphic</a></div>
<dt>{{ _('Followers') }}</dt> </div>
<dd data-module="followers-counter" data-module-id="{{ pkg.id }}" data-module-num_followers="{{ num_followers }}">{{ h.SI_number_span(num_followers) }}</dd> {% endfor %}
</dl> {% endif %}
</div> {% block nums %}
{% endblock %} <div class="nums">
{% block follow_button %} <dl>
{% if not hide_follow_button %} <dt>{{ _('Followers') }}</dt>
<div class="follow_button"> <dd>{{ h.SI_number_span(h.follow_count('dataset', pkg.id)) }}</dd>
{{ h.follow_button('dataset', pkg.id) }} </dl>
</div> </div>
{% endif %} {% endblock %}
{% block follow_button %}
{% if not hide_follow_button %}
<div class="follow_button">
{{ h.follow_button('dataset', pkg.name) }}
</div>
{% endif %}
{% endblock %}
{% endblock %} {% endblock %}
{% endblock %} </div>
</div> </div>
</div> </section>
</section> {% endif %}
{% endif %} {% endblock %}
{% endblock %}

View File

@ -0,0 +1,6 @@
{% set qr_code_image = h.d4science_get_qrcode_for_url(package_url) %}
{% block package_qrcode_for_url %}
<div style="padding: 1px;"><img src='data:image/svg+xml;base64, {{ qr_code_image }}' alt={{ package_url }}> </div>
{% endblock %}

View File

@ -1,82 +1,108 @@
{# {% set can_edit = h.check_access('package_update', {'id':pkg.id }) %}
Renders a single resource with icons and view links. {% set url_action = 'resource_edit' if url_is_edit and can_edit else 'resource_read' %}
{# {% set url = h.url_for(controller='package', action=url_action, id=pkg.name, resource_id=res.id) %} #}
res - A resource dict to render {% set url = h.url_for('dataset_resource.read', id=pkg.name, resource_id=res.id) %}
pkg - A package dict that the resource belongs to
can_edit - Whether the user is allowed to edit the resource
url_is_edit - Whether the link to the resource should be to editing it (set to False to make the link view the resource)
url - URL of the resource details page(resource edit/read depending on url_is_edit, by default).
Example:
{% snippet "package/snippets/resource_item.html", res=resource, pkg=pkg, can_edit=True, url_is_edit=False %}
#}
{% set url_action = pkg.type ~ ('_resource.edit' if url_is_edit and can_edit else '_resource.read') %}
{% set url = url or h.url_for(url_action, id=pkg.name, resource_id=res.id) %}
<li class="resource-item" data-id="{{ res.id }}"> <li class="resource-item" data-id="{{ res.id }}">
{# Added by Francesco Mangiacrapa block custom_view_on_resources see:4851 #}
{% block custom_view_on_resources %}
{% set user = c.user %}
{% if user %}
{% block resource_item_title %} {% block resource_item_title %}
<a class="heading" href="{{ url }}" title="{{ res.name or res.description }}"> <a class="heading" href="{{ url }}" title="{{ res.name or res.description }}">
{{ h.resource_display_name(res) | truncate(50) }}<span class="format-label" property="dc:format" data-format="{{ res.format.lower() or 'data' }}">{{ h.get_translated(res, 'format') }}</span> {{ h.resource_display_name(res) | truncate(50) }}<span class="format-label" property="dc:format" data-format="{{ res.format.lower() or 'data' }}">{{ res.format }}</span>
{{ h.popular('views', res.tracking_summary.total, min=10) if res.tracking_summary }} {{ h.popular('views', res.tracking_summary.total, min=10) }}
</a> </a>
{% endblock %} {% endblock %}
{% block resource_item_description %} {% block resource_item_description %}
<p class="description"> <p class="description">
{% if res.description %} {% if res.description %}
{{ h.markdown_extract(h.get_translated(res, 'description'), extract_length=80) }} {{ h.markdown_extract(res.description, extract_length=80) }}
{% endif %} {% endif %}
</p> </p>
{% endblock %} {% endblock %}
{% block resource_item_explore %} {% block resource_item_explore %}
{% if not url_is_edit %} {% if not url_is_edit %}
{# Only if can edit, explorer button is shown with several facility #}
{% if can_edit %}
<div class="dropdown btn-group"> <div class="dropdown btn-group">
<a href="#" class="btn btn-primary dropdown-toggle" type="button" id="dropdownExplorer" data-bs-toggle="dropdown" aria-expanded="false"> <a href="#" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-share"></i> <i class="icon-share-alt"></i>
{{ _('Explore') }} {{ _('Explore') }}
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownExplorer"> <ul class="dropdown-menu">
{% block resource_item_explore_links %} {% block resource_item_explore_links %}
{% block explore_view %}
<li>
<a class="dropdown-item" href="{{ url }}">
{% if res.has_views %}
<i class="fa fa-chart-bar"></i>
{{ _('Preview') }}
{% else %}
<i class="fa fa-info-circle"></i>
{{ _('More information') }}
{% endif %}
</a>
</li>
{% endblock explore_view %}
{% if res.url and h.is_url(res.url) %}
<li> <li>
<a class="dropdown-item resource-url-analytics" href="{{ res.url }}" target="_blank" rel="noreferrer"> <a href="{{ url }}">
{% if res.has_views or res.url_type == 'upload' %} {% if res.has_views %}
<i class="fa fa-arrow-circle-down"></i> <i class="icon-bar-chart"></i>
{{ _('Download') }} {{ _('Preview') }}
{% else %} {% else %}
<i class="fa fa-external-link"></i> <i class="icon-info-sign"></i>
{{ _('Go to resource') }} {{ _('More information') }}
{% endif %} {% endif %}
</a> </a>
</li> </li>
{% if res.url and h.is_url(res.url) %}
{# Added by Francesco Mangiacrapa #}
<script type="text/javascript" >
//handles the click event
function handleClick(event, element, url) {
window.open(url, "_blank", null);
return false;
}
</script>
{# Comment by Francesco Mangiacrapa, in order to avoid "Download" and "Go to Resource" facilities through the Explore button #}
<!--<li>
<a class="resource-url-analytics" href="#" onclick="return handleClick(event, this, '{{ res.url }}');">
{% if res.has_views %}
<i class="icon-download"></i>
{{ _('Download') }}
{% else %}
<i class="icon-external-link"></i>
{{ _('Go to resource') }}
{% endif %}
</a>
</li>-->
{% endif %} {% endif %}
{% if can_edit %} {#{% if can_edit %}#}
<li> <li>
<a class="dropdown-item" href="{{ h.url_for(pkg.type ~ '_resource.edit', id=pkg.name, resource_id=res.id) }}"> {# <a href="{{ h.url_for(controller='package', action='resource_edit', id=pkg.name, resource_id=res.id) }}"> #}
<i class="fa fa-pencil-square"></i> <a href="{{ h.url_for('dataset_resource.edit', id=pkg.name, resource_id=res.id) }}">
<i class="icon-edit"></i>
{{ _('Edit') }} {{ _('Edit') }}
</a> </a>
</li> </li>
{% endif %} {#{% endif %}#}
{% endblock %} {% endblock %}
</ul> </ul>
</div> </div>
{% else %}
<a href="{{ url }}" title="Go to {{ url }}">
{{ _('Go to resource') }}
</a>
{% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% else %}
{% block resource_item_title2 %}
{# Updated by Francesco Mangiacrapa, see: #10056 #}
<a class="heading" href="javascript:CKAN_D4S_Functions_Util.showPopupD4S(null, 'myPopup_{{res.id}}', '250px');">
{{ h.resource_display_name(res) | truncate(50) }}<span class="format-label" property="dc:format" data-format="{{ res.format.lower() or 'data' }}">{{ res.format }}</span>
{{ h.popular('views', res.tracking_summary.total, min=10) }}
</a>
{% endblock %}
<div class="popupD4S" onclick="CKAN_D4S_Functions_Util.showPopupD4S(event, 'myPopup_{{res.id}}', '250px')">
{% block resource_item_description2 %}
<p class="description">
{% if res.description %}
{{ h.markdown_extract(res.description, extract_length=80) }}
{% endif %}
</p>
{% endblock %}
<span class="popuptext" id="myPopup_{{res.id}}">The resource: '{{ h.resource_display_name(res) | truncate(30) }}' is not accessible as guest user. You must login to access it!</span>
</div>
{% endif %}
{% endblock %}
</li> </li>

View File

@ -1,37 +1,77 @@
{# {#
Renders a list of resources with icons and view links. Renders a list of resources with icons and view links.
resources - A list of resources (dicts) to render resources - A list of resources to render
pkg - A package dict that the resources belong to. pkg - A package object that the resources belong to.
Example: Example:
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
#} #}
<section id="dataset-resources" class="resources"> <script type="text/javascript" >
<h2>{{ _('Data and Resources') }}</h2>
{% block resource_list %} //Task #10389
{% if resources %} window.addEventListener("message",
<ul class="{% block resource_list_class %}resource-list{% endblock %}"> function (e) {
{% block resource_list_inner %}
{% set can_edit = can_edit or h.check_access('package_update', {'id':pkg.id }) %} var curr_loc = window.location.toString()
{% for resource in resources %} var orgin = e.origin.toString()
{% snippet 'package/snippets/resource_item.html', pkg=pkg, res=resource, can_edit=can_edit %} if(curr_loc.startsWith(orgin)){
{% endfor %} //alert("ignoring message from myself");
{% endblock %} return;
</ul> }
{% else %} //console.log("origin: "+e.data)
{% block resource_list_empty %} if(e.data == null)
{% if h.check_access('resource_create', {'package_id': pkg['id']}) %} return;
{% trans url=h.url_for(pkg.type ~ '_resource.new', id=pkg.name) %}
<p class="empty">This dataset has no data, <a href="{{ url }}">why not add some?</a></p> var pMess = JSON.parse(e.data)
{% endtrans %} //console.log(pMess.explore_vres_landing_page)
{% else %} window.linktogateway = pMess.explore_vres_landing_page;
<p class="empty">{{ _('This dataset has no data') }}</p> goToHomeLink("resource-private")
{% endif %} },false);
{% endblock %}
//Task #10389
goToHomeLink = function (divId) {
var myDiv = document.getElementById(divId);
var myHost = window.linktogateway.substring(0, window.linktogateway.lastIndexOf("/"));
console.log("my host: "+myHost)
if(myDiv && myHost){
myDiv.innerHTML= myDiv.innerHTML + ". <a target=\"_blank\" href="+myHost+"/home"+">Go to Login...</a>";
}
}
</script>
<section id="dataset-resources" class="resources">
<div class="sectiontitle">{{ _('Data and Resources') }}</div>
{% set user = c.user %}
{# Added by Francesco Mangiacrapa #10389 #}
{% if not user %}
<div id="resource-private" class="required-access">To access the resources you must log in</div>
{% endif %} {% endif %}
{% endblock %} {# end #}
</section> {% block resource_list %}
{% if resources %}
<ul class="{% block resource_list_class %}resource-list{% endblock %}">
{% block resource_list_inner %}
{% for resource in resources %}
{% snippet 'package/snippets/resource_item.html', pkg=pkg, res=resource %}
{% endfor %}
{% endblock %}
</ul>
{% else %}
{% if h.check_access('resource_create', {'package_id': pkg['id']}) %}
{% trans url=h.url_for(controller='package', action='new_resource', id=pkg.name) %}
<p class="empty">This dataset has no data, <a href="{{ url }}">why not add some?</a></p>
{% endtrans %}
{% else %}
<p class="empty">{{ _('This dataset has no data') }}</p>
{% endif %}
{% endif %}
{% endblock %}
</section>

View File

@ -13,7 +13,7 @@
<ul class="{{ _class }}"> <ul class="{{ _class }}">
{% for tag in tags %} {% for tag in tags %}
<li> <li>
<a class="{% block tag_list_item_class %}tag{% endblock %}" href="{% url_for 'dataset.search', tags=tag.name %}" title="{{ tag.display_name }}">{{ tag.display_name|truncate(22) }}</a> <a class="{% block tag_list_item_class %}tag{% endblock %}" href="{% url_for 'dataset.search', tags=tag.name %}" title="{{ tag.display_name }}"></a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>