{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2024 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{% extends "invenio_communities/details/base.html" %}
{% from "invenio_communities/collections/macros.html" import render_depth_one_collection %}

{% set active_community_header_menu_item= 'browse' %}

{%- block javascript %}
{{ super() }}
{{ webpack['invenio-app-rdm-collections-search.js'] }}
{%- endblock %}

{%- block page_body %}
{{ super() }}
{% set root_collection=collection[collection.root] %}
<div class="ui container fluid page-subheader rel p-10 mr-0-mobile ml-0-mobile">
  <div class="collection-header ui container">
    <h1 class="ui medium header">
      {%- if logo -%}
        <img src="{{ logo }}" width="45" height="45" alt="Collection logo"/>
      {%- endif -%}
      <div class="content">{{ root_collection.title }}</div>
    </h1>
  </div>
</div>
<!-- Breadcrumbs -->
<div class="ui container mb-0">
  <div class="ui breadcrumb">
    <a class="section"
      href="{{ url_for('invenio_app_rdm_communities.communities_browse', pid_value=community.slug ) }}">
      {{ _("Browse") }}
    </a>
    <i class="angle right icon divider mr-0" aria-hidden="true"></i>

    {% if root_collection.breadcrumbs %}
    {%- for breadcrumb in root_collection.breadcrumbs -%}
    <a class="section" href="{{ breadcrumb.link }}">
      {{ breadcrumb.title }}
    </a>
    {% if not loop.last %}
    <i class="angle right icon divider mr-0" aria-hidden="true"></i>
    {% endif %}
    {%- endfor -%}
    {%- endif -%}
  </div>
</div>
<div class="ui divider mt-10 mb-0" aria-hidden="true"></div>
<!-- Collection record search -->
<div id="collection-search"
  data-invenio-search-config='{{search_app_collection_config(app_id="InvenioAppRDM.CollectionsSearch", endpoint=root_collection["links"]["search"]) | tojson }}'
  data-permissions='{{ permissions | tojson }}'>
</div>
{%- endblock page_body %}
