{# -*- 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.
#}

{% extends "invenio_communities/base.html" %}

{%- set title = _("Search communities") -%}

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

{%- block page_body %}
<div class="ui container fluid page-subheader-outer compact">
  <div class="ui container community-search page-subheader">
    <h3 class="ui header">{{_("Communities")}}</h3>
  </div>
</div>
<div id="communities-search" class="rel-mt-3" data-invenio-search-config='{
  "aggs": [
    {
      "aggName": "type",
      "field": "metadata.type",
      "title": "{{_("Type")}}"
    },
    {
      "aggName": "domain",
      "field": "metadata.domains",
      "title": "{{_("Domain")}}"
    }
  ],
  "appId": "communities-search",
  "initialQueryState": {
      "hiddenParams": null,
      "size": 10,
      "page": 1,
      "sortBy": "bestmatch"
  },
  "layoutOptions": {
      "gridView": false,
      "listView": true
  },
  "paginationOptions": {
      "defaultValue": 10,
      "resultsPerPage": [
          {
              "text": "10",
              "value": 10
          },
          {
              "text": "20",
              "value": 20
          },
          {
              "text": "50",
              "value": 50
          }
      ]
  },
  "searchApi": {
      "axios": {
          "headers": {
              "Accept": "application/json"
          },
          "url": "/api/communities",
          "withCredentials": true
      }
  },
  "sortOrderDisabled": true,
  "defaultSortingOnEmptyQueryString": {
      "sortBy": "newest"
  },
  "sortOptions": [
      {
          "sortBy": "bestmatch",
          "text": "{{_("Best match")}}"
      },
      {
          "sortBy": "newest",
          "text": "{{_("Newest")}}"
      },
      {
          "sortBy": "oldest",
          "text": "{{_("Oldest")}}"
      },
      {
          "sortBy": "version",
          "text": "{{_("Version")}}"
      }
  ]}' data-facets-config='{
      "organization":"{{_("Organization")}}",
      "event":"{{_("Event")}}",
      "topic":"{{_("Topic")}}",
      "project":"{{_("Project")}}"
  }'>
</div>
{%- endblock page_body %}
