{#
  Copyright (C) 2020 CERN.
  Copyright (C) 2020 Northwestern University.

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

{% set subjects = record.metadata.subjects %}

{% if subjects %}
<dd class="top-bottom-padded" id="record-subjects">
  {%- for scheme, subjects in subjects|selectattr("scheme")|groupby('scheme')|sort(attribute='scheme') %}
  <div class="ui grid">
    <div class="sixteen wide subject-scheme column">
      <span class="ui tiny subject header">{{scheme}}</span>
    </div>
    <div class="sixteen wide subject-label column">
      {%- for subject in subjects %}
          <span class="subject">{{ subject.subject}}</span>
        {%- endfor %}
    </div>
  </div>
  {%- endfor %}
  {% set keywords = subjects|rejectattr("scheme")|list %}
  {% if keywords %}
  <div class="ui grid">
    <div class="sixteen wide subject-scheme column">
      <span class="ui tiny subject header">{{_('Keywords')}}</span>
    </div>
    <div class="sixteen wide subject-label column">
    {%- for subject in keywords %}
      <span class="subject">{{ subject.subject}}</span>
    {%- endfor %}
    </div>
  </div>
  {% endif %}
</dd>
{% endif %}
