{% extends 'base.html' %}

{% block content %}
  <div id="homepage">

    <h2 class="page-title">{{ _('Welcome to MetaBrainz!') }}</h2>

    <div id="intro">
      <p>
        {{ _('The MetaBrainz Foundation is a non-profit that believes in free, open
        access to data. It has been set up to build community maintained
        databases and make them available in the public domain or under Creative
        Commons licenses.') }}
      </p>
      <p>
        {{ _('Our data is mostly gathered by volunteers and verified
        by peer review to ensure it is consistent and correct. All
        <a href="%(account_type_url)s">non-commercial use</a> of this data is free,
        but <a href="%(account_type_url)s">commercial supporters</a> are asked to
        <a href="%(account_type_url)s">support us</a> in order to help fund the
        project. We encourage all data supporters to contribute to the data gathering process so
        that our data can be as comprehensive as possible.', account_type_url=url_for('supporters.account_type')) }}
      </p>
      <p>
      To find out more about our datasets, please take a look at our <a href="{{ url_for("index.datasets") }}">
      datasets page</a>.
      </p>
    </div>

    <div class="metaCarousel">
      <div id="projects-carousel" class="carousel slide" data-pause="hover" data-ride="carousel">
        <div class="carousel-inner" role="listbox">
          <div class="item active">
            <a href="https://musicbrainz.org/">
              <img src="{{ url_for('static', filename='img/logos/musicbrainz.svg') }}" />
            </a>
            <div class="caption">
              {{ _('An open music encyclopedia that collects music metadata and makes it
              available to the public') }}<br />
              <em>{{ _('Sign up to use the <a href="%(account_type_url)s">Live Data Feed</a></em>',
              account_type_url=url_for('supporters.account_type')) }}
            </div>
          </div>
          <div class="item">
            <a href="https://picard.musicbrainz.org/">
              <img src="{{ url_for('static', filename='img/logos/picard.svg') }}" />
            </a>
            <div class="caption">
              {{ _('A cross-platform music tagger') }}
            </div>
          </div>
          <div class="item">
            <a href="https://bookbrainz.org/">
              <img src="{{ url_for('static', filename='img/logos/bookbrainz.svg') }}" />
            </a>
            <div class="caption">
              {{ _('An open encyclopedia which contains information about published literature') }}
            </div>
          </div>
          <div class="item">
            <a href="https://listenbrainz.org/">
              <img src="{{ url_for('static', filename='img/logos/listenbrainz.svg') }}" />
            </a>
            <div class="caption">
                {{ _('An open record of user listening habits') }}
            </div>
          </div>
          <div class="item">
            <a href="https://critiquebrainz.org/">
              <img src="{{ url_for('static', filename='img/logos/critiquebrainz.svg') }}" />
            </a>
            <div class="caption">
              {{ _('A repository for Creative Commons licensed music and book reviews') }}
            </div>
          </div>
          <div class="item">
            <a href="https://coverartarchive.org/">
              <img src="{{ url_for('static', filename='img/logos/coverartarchive.svg') }}" />
            </a>
            <div class="caption">
              {{ _('A repository of music cover art that is freely and easily accessible') }}
            </div>
          </div>
        </div>
        {# Controls #}
        <a class="left carousel-control" href="#projects-carousel" role="button" data-slide="prev">
          <span class="icon-prev" aria-hidden="true"></span>
          <span class="sr-only">{{ _('Previous') }}</span>
        </a>
        <a class="right carousel-control" href="#projects-carousel" role="button" data-slide="next">
          <span class="icon-next" aria-hidden="true"></span>
          <span class="sr-only">{{ _('Next') }}</span>
        </a>
      </div>
    </div>

    <div id="more-intro">
      <p>
        {{ _('The MetaBrainz Foundation believes in <a href="%(financial_reports_url)s">
        transparent finances</a> and is supported by <a href="%(donations_url)s">end user
        donations</a> and a number of <a href="%(sponsors_url)s">sponsors</a>
        who provide funds in order for the foundation to accomplish its goals. The foundation also
        has several <a href="%(supporters_url)s"> commercial supporters</a>
        who make use of our data sets.', financial_reports_url=url_for('financial_reports.index'),
        donations_url=url_for('payments.donate'),
        sponsors_url=url_for('index.sponsors'),
        supporters_url=url_for('supporters.supporters_list') ) }}
      </p>
    </div>

    {% if good_supporters %}
      <div class="featured-supporters homepage-section">
        {% for supporter in good_supporters %}
          <div class="supporter">
              <a href="{{ url_for('supporters.supporters_list') }}">
                <div class="logo-container">
                  {% if supporter.logo_filename %}
                    <img class="logo" src="{{ url_for('static', filename='img/logos/supporters/'+supporter.logo_filename) }}"/>
                  {% elif supporter.org_logo_url %}
                    <img class="logo" src="{{ supporter.org_logo_url }}" />
                  {% else %}
                    <div class="name">{{ supporter.org_name }}</div>
                  {% endif %}
                </div>
              </a>
          </div>
        {% endfor %}
      </div>
    {% endif %}

    {% if bad_supporters %}
      <div class="homepage-section">
        {{ _('Unfortunately, some companies listed below use data we provide without contributing back.
        <a href="%(bad_customers_url)s">Find out more</a> about them or
        <a href="%(account_type_url)s">sign up</a>!',
        bad_customers_url=url_for('index.bad_customers'),
        account_type_url=url_for('supporters.account_type')) }}
      </div>

      <div id="featured-supporters" class="row">
        {% for supporter in bad_supporters %}
          <div class="col-sm-3 supporter">
            {% if supporter.logo_filename %}
              <span><a href="{{ url_for('index.bad_customers') }}"><img class="logo" src="{{ url_for('static', filename='img/logos/supporters/'+supporter.logo_filename) }}"/></a></span>
            {% elif supporter.org_logo_url %}
              <span><a href="{{ url_for('index.bad_customers') }}"><img class="logo" src="{{ supporter.org_logo_url }}"/></a></span>
            {% else %}
              <span class="name"><a href="{{ url_for('index.bad_customers') }}">{{ supporter.org_name }}</a></span>
            {% endif %}
          </div>
        {% endfor %}
      </div>
    {% endif %}

    <div id="additional-intro">
      {{ _('To get more information about the foundation, go to the
      <a href="%(about_url)s">about</a> page.', about_url=url_for('index.about')) }}
    </div>

  </div>
{% endblock %}

{% block scripts %}
  {{ super() }}
  <script type="text/javascript">
    $(document).ready(function() {
      var $carousel = $(".metaCarousel");
      $carousel.addClass("iHaveJavasript");
    });
  </script>
{% endblock %}
