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

  This file is part of Invenio.
  Copyright (C) 2016-2020 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.
#}
{# TODO: Use url_for instead #}

<div class="community-header">
  <div class="ui container relaxed grid">
    <div class="row">
      {% if logo %}
      <div class="two wide column community-logo">
        <div class="ui tiny rounded image">
          <img src="{{logo.links.self}}" alt="No image found"/>
        </div>
      </div>
      <div class="ten wide column">
      {% else %}
      <div class="twelve wide column">
      {% endif %}
        <h2 class="ui header">{{ community.metadata.title }}</h2>
        <p>{{ community.metadata.description }}</p>
      </div>
      {# TODO: Add proper statistics #}
      <!-- <div class="two wide floated right column">
        <div class="ui mini statistic">
          <div class="value">
            5,550
          </div>
          <div class="label">
            Views
          </div>
        </div>
      </div>
      <div class="two wide floated right column">
        <div class="ui mini statistic">
          <div class=" value">
            4,200
          </div>
          <div class="label">
            Downloads
          </div>
        </div>
      </div> -->
    </div>
    <!-- <div class="three wide column"> -->
      {# TODO: use "url_for" with appropriate querystring parameter #}
      <!-- <a href="/uploads/new/?community={{ community.id }}" class="ui positive button">
        <i class="plus icon"></i>
        New upload
      </a> -->
    <!-- </div> -->
    {% set header_menu_items = {
      'search': ('Search', url_for('invenio_communities.communities_detail', pid_value=community.id), 'search icon'),
      'settings': ('Settings', url_for('invenio_communities.communities_settings', pid_value=community.id), 'settings icon'),
    } %}
    <div class="row">
      <div class="ui container secondary pointing menu community-header">
        {% for header_menu_key, (header_menu_item, header_menu_link, menu_icon) in header_menu_items.items() %}
          <a class="item {{ 'active' if active_header_menu_item == header_menu_key }} {{ 'disabled' if not header_menu_link }}" href="{{ header_menu_link }}"><i aria-hidden="true" class="{{menu_icon}}"></i>{{ header_menu_item }}</a>
        {% endfor %}
      </div>
    </div>
  </div>
</div>
