Skip to content
Snippets Groups Projects
Commit 3b583c0f authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Refactored contact details

parent a39760b3
Branches
Tags
1 merge request!51Display contact information on dataset page and use text-ellipsis for long description texts
{% set author_name = pkg.author %}
{% set author_email = h.extract_email(pkg.author_email) %}
{% set author_tel = h.odsh_extract_value_from_extras(pkg.extras,'author_tel')%}
{% set author_fax = h.odsh_extract_value_from_extras(pkg.extras,'author_fax')%}
{% set author_city = h.odsh_extract_value_from_extras(pkg.extras,'author_city')%}
{% set author_zip = h.odsh_extract_value_from_extras(pkg.extras,'author_zip')%}
{% set author_street = h.odsh_extract_value_from_extras(pkg.extras,'author_street')%}
{% set author_country = h.odsh_extract_value_from_extras(pkg.extras,'author_country')%}
{% set author_zip = h.odsh_extract_value_from_extras(pkg.extras,'author_zip')%}
{% set author_data = {
'name': pkg.author,
'email': h.extract_email(pkg.author_email),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'author_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'author_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'author_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'author_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'author_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'author_country')
} %}
{% set maintainer_name = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_name')%}
{% set maintainer_email = h.extract_email(h.odsh_extract_value_from_extras(pkg.extras,'maintainer_email'))%}
{% set maintainer_tel = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_tel')%}
{% set maintainer_fax = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_fax')%}
{% set maintainer_city = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_city')%}
{% set maintainer_zip = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_zip')%}
{% set maintainer_street = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_street')%}
{% set maintainer_country = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_country')%}
{% set maintainer_zip = h.odsh_extract_value_from_extras(pkg.extras,'maintainer_zip')%}
{% set maintainer_data = {
'name': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_name'),
'email': h.extract_email(h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_email')),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'maintainer_country')
} %}
{% set contact_name = h.odsh_extract_value_from_extras(pkg.extras,'contact_name')%}
{% set contact_email = h.extract_email(h.odsh_extract_value_from_extras(pkg.extras,'contact_email'))%}
{% set contact_tel = h.odsh_extract_value_from_extras(pkg.extras,'contact_tel')%}
{% set contact_fax = h.odsh_extract_value_from_extras(pkg.extras,'contact_fax')%}
{% set contact_city = h.odsh_extract_value_from_extras(pkg.extras,'contact_city')%}
{% set contact_zip = h.odsh_extract_value_from_extras(pkg.extras,'contact_zip')%}
{% set contact_street = h.odsh_extract_value_from_extras(pkg.extras,'contact_street')%}
{% set contact_country = h.odsh_extract_value_from_extras(pkg.extras,'contact_country')%}
{% set contact_zip = h.odsh_extract_value_from_extras(pkg.extras,'contact_zip')%}
{% set contact_data = {
'name': h.odsh_extract_value_from_extras(pkg.extras, 'contact_name'),
'email': h.extract_email(h.odsh_extract_value_from_extras(pkg.extras, 'contact_email')),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'contact_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'contact_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'contact_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'contact_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'contact_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'contact_country')
} %}
{% set publisher_name = h.odsh_extract_value_from_extras(pkg.extras,'publisher_name')%}
{% set publisher_email = h.extract_email(h.odsh_extract_value_from_extras(pkg.extras,'publisher_email'))%}
{% set publisher_tel = h.odsh_extract_value_from_extras(pkg.extras,'publisher_tel')%}
{% set publisher_fax = h.odsh_extract_value_from_extras(pkg.extras,'publisher_fax')%}
{% set publisher_city = h.odsh_extract_value_from_extras(pkg.extras,'publisher_city')%}
{% set publisher_zip = h.odsh_extract_value_from_extras(pkg.extras,'publisher_zip')%}
{% set publisher_street = h.odsh_extract_value_from_extras(pkg.extras,'publisher_street')%}
{% set publisher_country = h.odsh_extract_value_from_extras(pkg.extras,'publisher_country')%}
{% set publisher_zip = h.odsh_extract_value_from_extras(pkg.extras,'publisher_zip')%}
{% set publisher_data = {
'name': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_name'),
'email': h.extract_email(h.odsh_extract_value_from_extras(pkg.extras, 'publisher_email')),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'publisher_country')
} %}
{% set originator_data = {
'name': h.odsh_extract_value_from_extras(pkg.extras, 'originator_name'),
'email': h.extract_email(h.odsh_extract_value_from_extras(pkg.extras, 'originator_email')),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'originator_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'originator_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'originator_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'originator_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'originator_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'originator_country')
} %}
{% if pkg.author or maintainer_name or contact_name or publisher_name %}
<div class="section">
<h3>{{ _('Contact') }}</h3>
{% if author_name %}
<div class="sub-section">
<h5>{{ _('Creator') }}</h5>
<table class="table table-striped">
<tbody>
<tr>
<td>
<p>
<span property="dc:creator">{{ author_name }}</span>
</p>
{% if author_street %}
<p>
{% if author_street %}
{{ author_street }}
<br>
{% endif %}
{% if author_zip and author_city %}
{{ author_zip }}
{{ author_city }}
<br>
{% endif %}
{% if author_country %}
{{ author_country }}
{% endif %}
</p>
{% endif %}
{% if author_email or author_tel or author_fax %}
<div class="details">
{% if author_email %}
<div class="details-item">
<i class="fa-solid fa-envelope"></i>
<a href="mailto:{{ author_email }}">
{{ author_email }}
</a>
</div>
{% endif %}
{% if author_tel %}
<div class="details-item">
<i class="fa-solid fa-phone"></i>
<a href="tel:{{ author_tel }}">
{{ author_tel }}
</a>
</div>
{% endif %}
{% if author_fax %}
<div class="details-item">
<i class="fa-solid fa-fax"></i>
<a href="fax:{{ author_fax }}">
{{ author_fax }}
</a>
</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
{% set contributor_data = {
'name': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_name'),
'email': h.extract_email(h.odsh_extract_value_from_extras(pkg.extras, 'contributor_email')),
'tel': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_tel'),
'fax': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_fax'),
'city': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_city'),
'zip': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_zip'),
'street': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_street'),
'country': h.odsh_extract_value_from_extras(pkg.extras, 'contributor_country')
} %}
{% if publisher_name %}
<div class="sub-section">
<h5>{{ _('Publisher') }}</h5>
<table class="table table-striped">
<tbody>
<tr>
<td>
<p>
<span property="dc:publisher">{{ publisher_name }}</span>
</p>
{% if publisher_street %}
<p>
{% if publisher_street %}
{{ publisher_street }}
<br>
{% endif %}
{% if publisher_zip and publisher_city %}
{{ publisher_zip }}
{{ publisher_city }}
<br>
{% endif %}
{% if publisher_country %}
{{ publisher_country }}
{% endif %}
</p>
{% endif %}
{% if publisher_email or publisher_tel or publisher_fax %}
<div class="details">
{% if publisher_email %}
<div class="details-item">
<i class="fa-solid fa-envelope"></i>
<a href="mailto:{{ publisher_email }}">
{{ publisher_email }}
</a>
</div>
{% endif %}
{% if publisher_tel %}
<div class="details-item">
<i class="fa-solid fa-phone"></i>
<a href="tel:{{ publisher_tel }}">
{{ publisher_tel }}
</a>
</div>
{% endif %}
{% if publisher_fax %}
<div class="details-item">
<i class="fa-solid fa-fax"></i>
<a href="fax:{{ publisher_fax }}">
{{ publisher_fax }}
</a>
</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
{% if contact_name %}
<div class="sub-section">
<h5>{{ _('Contact Person') }}</h5>
<table class="table table-striped">
<tbody>
<tr>
<td>
<p>
<span>{{ contact_name }}</span>
</p>
{% if contact_street %}
<p>
{% if contact_street %}
{{ contact_street }}
<br>
{% endif %}
{% if contact_zip and contact_city %}
{{ contact_zip }}
{{ contact_city }}
<br>
{% endif %}
{% if contact_country %}
{{ contact_country }}
{% endif %}
</p>
{% endif %}
{% if contact_email or contact_tel or contact_fax %}
<div class="details">
{% if contact_email %}
<div class="details-item">
<i class="fa-solid fa-envelope"></i>
<a href="mailto:{{ contact_email }}">
{{ contact_email }}
</a>
</div>
{% endif %}
{% if contact_tel %}
<div class="details-item">
<i class="fa-solid fa-phone"></i>
<a href="tel:{{ contact_tel }}">
{{ contact_tel }}
</a>
</div>
{% endif %}
{% if contact_fax %}
<div class="details-item">
<i class="fa-solid fa-fax"></i>
<a href="fax:{{ contact_fax }}">
{{ contact_fax }}
</a>
</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
{% if author_data.name or maintainer_data.name or contact_data.name or publisher_data.name or originator_data.name or contributor_data.name %}
<div class="section">
<h3>{{ _('Contact') }}</h3>
{% if maintainer_name %}
<div class="sub-section">
<h5>{{ _('Maintainer') }}</h5>
<table class="table table-striped">
<tbody>
<tr>
<td>
<p>
<span property="dc:maintainer">{{ maintainer_name }}</span>
</p>
{% if maintainer_street %}
<p>
{% if maintainer_street %}
{{ maintainer_street }}
<br>
{% endif %}
{% if maintainer_zip and maintainer_city %}
{{ maintainer_zip }}
{{ maintainer_city }}
<br>
{% endif %}
{% if maintainer_country %}
{{ maintainer_country }}
{% endif %}
</p>
{% endif %}
{% if maintainer_email or maintainer_tel or maintainer_fax %}
<div class="details">
{% if maintainer_email %}
<div class="details-item">
<i class="fa-solid fa-envelope"></i>
<a href="mailto:{{ maintainer_email }}">
{{ maintainer_email }}
</a>
</div>
{% endif %}
{% if maintainer_tel %}
<div class="details-item">
<i class="fa-solid fa-phone"></i>
<a href="tel:{{ maintainer_tel }}">
{{ maintainer_tel }}
</a>
</div>
{% endif %}
{% if maintainer_fax %}
<div class="details-item">
<i class="fa-solid fa-fax"></i>
<a href="fax:{{ maintainer_fax }}">
{{ maintainer_fax }}
</a>
</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
{% snippet "package/snippets/contact_details_item.html", data=author_data, title=_('Creator') %}
{% snippet "package/snippets/contact_details_item.html", data=maintainer_data, title=_('Maintainer') %}
{% snippet "package/snippets/contact_details_item.html", data=contact_data, title=_('Contact') %}
{% snippet "package/snippets/contact_details_item.html", data=publisher_data, title=_('Publisher') %}
{% snippet "package/snippets/contact_details_item.html", data=originator_data, title=_('Originator') %}
{% snippet "package/snippets/contact_details_item.html", data=contributor_data, title=_('Contributor') %}
</div>
{% endif %}
\ No newline at end of file
{% if data and title %}
<div class="sub-section">
<h5>{{ title }}</h5>
<table class="table table-striped">
<tbody>
<tr>
<td>
<p>
<span>{{ data.name }}</span>
</p>
{% if data.street %}
<p>
{% if data.street %}
{{ data.street }}
{% endif %}
{% if data.zip and data.city %}
<br>
{{ data.zip }}
{{ data.city }}
{% endif %}
{% if data.country %}
<br>
{{ data.country }}
{% endif %}
</p>
{% endif %}
{% if data.email or data.tel or data.fax %}
<div class="details">
{% if data.email %}
<div class="details-item">
<i class="fa-solid fa-envelope"></i>
<a href="mailto:{{ data.email }}">
{{ data.email }}
</a>
</div>
{% endif %}
{% if data.tel %}
<div class="details-item">
<i class="fa-solid fa-phone"></i>
<a href="tel:{{ data.tel }}">
{{ data.tel }}
</a>
</div>
{% endif %}
{% if data.fax %}
<div class="details-item">
<i class="fa-solid fa-fax"></i>
<a href="fax:{{ data.fax }}">
{{ data.fax }}
</a>
</div>
{% endif %}
</div>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment