Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontpage: display verified community logo #729

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions templates/semantic-ui/zenodo_rdm/macros/communities_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
# as an Intergovernmental Organization or submit itself to any jurisdiction.
-#}

{% macro communities_list(communities=None) %}
{% macro communities_list(communities=None, branded=None) %}
{% for community in communities %}
{% set community_title = community.metadata.get("title", "No title") if community.metadata %}
<span class="display-inline-flex comma-separated">
<a
href="/communities/{{ community.slug }}"
title="{{ community_title }}: {{_('Search')}}"
>
{{ community_title }}
</a>
</span>
{% if not (community.id == branded and community.theme) %}
<span class="display-inline-flex comma-separated">
<a
href="/communities/{{ community.slug }}"
title="{{ community_title }}: {{_('Search')}}"
>
{{ community_title }}
</a>
</span>
{% endif %}
{% endfor%}
{% endmacro %}
39 changes: 31 additions & 8 deletions templates/semantic-ui/zenodo_rdm/macros/record_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{% from "zenodo_rdm/macros/creators.html" import creators %}
{% from "zenodo_rdm/macros/communities_list.html" import communities_list %}

{% macro record_item(record=None) %}
{% macro record_item(record=None, highlightCommunity=True) %}
<li class="item">
<div class="content">

Expand All @@ -46,7 +46,7 @@
<i class="icon {{ access_status_icon }}" aria-hidden="true"></i>
{{ access_status }}
</div>
</div>
</div>

{# Title #}
<div class="header theme-primary-text">
Expand All @@ -68,12 +68,6 @@
{{ description | truncate(length=350, end='...') }}
</p>

{# Communities list #}
<h5>
{% set communities_entries = record.parent.communities.entries %}
<b>{{ _("Part of:")}} {{ communities_list(communities=communities_entries) }}</b>
</h5>

<div class="extra">
<div class="flex justify-space-between align-items-end">
{# Publishing details #}
Expand All @@ -87,6 +81,16 @@ <h5>
{% endif %}
</small>
</p>

{# Communities list #}
<p>
<small>
{% set communities_entries = record.parent.communities.entries %}
{% if communities_entries %}
<b>{{ _("Part of")}} {{ communities_list(communities=communities_entries, branded=record.parent.communities.default) }}</b>
{% endif %}
</small>
</p>
<p>
<small>
{% if publishing_journal %}
Expand Down Expand Up @@ -134,6 +138,25 @@ <h5>
{% endif %}
</small>
</div>
{% if highlightCommunity %}
{% set communities = record.parent.communities.entries %}
{% set branded_community_id = record.parent.communities.default %}

{% if communities and branded_community_id %}
{% for community in communities %}
{% if community.id == branded_community_id and community.theme %}
{% set primaryColor = community.theme.get('style').get('primaryColor') %}
<a href="/communities/{{ branded_community_id }}"
class="ui label themed-community-label"
style="background-color: {{ primaryColor }};"
>
{{ community.metadata.title }}
<img src="/api/communities/{{ branded_community_id }}/logo" alt class="ui image themed-community-logo right-floated">
</a>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
</div>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1 class="ui large header">{{ title }}</h1>
<div class="ui fluid stackable three column grid">
{% for record in records %}
<ul class="ui column items m-0">
{{ record_item(record=record) }}
{{ record_item(record=record, highlightCommunity=False) }}
</ul>
{% endfor %}
</div>
Expand Down
Loading