Skip to content

Commit

Permalink
frontpage: display verified community logo
Browse files Browse the repository at this point in the history
* closes #716
  • Loading branch information
anikachurilova committed Feb 27, 2024
1 parent 53374ee commit 15c05ed
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
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

0 comments on commit 15c05ed

Please sign in to comment.