{% load static i18n account socialaccount %}
{% user_display user as user_display %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as languages %}
{% trans 'all' as all_word %}

<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="{% static "css/style.css" %}" charset="utf-8">
    <!-- SEO -->
    <meta name=”description” content=”{% block meta_description %}Amiibofindr{% endblock %}”>
    <!-- Twitter -->
    <meta content="{% block meta_twitter_card %}summary{% endblock %}" name="twitter:card" />
    <meta content="{% block meta_twitter_title %}{% endblock %}" name="twitter:title" />
    <meta content="{% block meta_twitter_description %}{% endblock %}" name="twitter:description" />
    <meta content="{% block meta_twitter_image %}{% endblock %}" name="twitter:image:src" />
    <meta content="{% block meta_twitter_url %}{% endblock %}" property="twitter:url" />
    <!-- Facebook -->
    <meta content="{% block meta_og_title %}{% endblock %}" property="og:title" />
    <meta content="{% block meta_og_type %}object{% endblock %}" property="og:type" />
    <meta content="{% block meta_og_image %}{% endblock %}" property="og:image" />
    <meta content="{% block meta_og_url %}{% endblock %}" property="og:url" />
    <meta content="{% block meta_og_description %}{% endblock %}" property="og:description" />
    <title>{% block page_title %}AmiiboFindr{% endblock %}</title>
  </head>

  <body data-views="{% block js_views %}money{% endblock %}">
    {% providers_media_js %}
    <div class="ui page grid">
      <div class="computer tablet only row">
        <div class="ui large menu fluid navbar">
          <a href="{% url 'home:home' %}" class="brand item">Amiibofindr</a>
          <div class="ui dropdown item">
            {% trans "Figures" %}
            <i class="dropdown icon"></i>
            <div class="menu fixzindex">
              <a class="item" href="{% url 'amiibo:figures-all' %}">{% trans "All" %}</a>
              <div class="ui divider"></div>
              {% for col in COLLECTIONS_FIGURES %}
                <a class="item" href="{{ col.get_absolute_url_figures }}">{{ col.name }}</a>
              {% endfor %}
            </div>
          </div>
          <div class="ui dropdown item">
            {% trans "Cards" %}
            <i class="dropdown icon"></i>
            <div class="menu fixzindex">
              <a class="item" href="{% url 'amiibo:cards-all' %}">{% trans "All" %}</a>
              {% for col in COLLECTIONS_CARDS %}
                <a class="item" href="{{ col.get_absolute_url_cards }}">{{ col.name }}</a>
              {% endfor %}
            </div>
          </div>
          <div class="right menu">
            {% if user.is_authenticated %}
              <div class="ui dropdown item">
                <i class="icon user"></i> {{ user_display }}
                <i class="dropdown icon"></i>
                <div class="menu fixzindex">
                  <a class="item" href="{% url 'profile:main' user.username %}">{% trans "My public profile" %}</a>
                  <a class="item" href="{% url 'account_change_password' %}">{% trans "Change password" %}</a>
                  <a class="item" href="{% url 'socialaccount_connections' %}">{% trans "Social accounts" %}</a>
                  <a class="item" href="{% url 'account_email' %}">{% trans "Emails" %}</a>
                  <div class="ui divider"></div>
                  <a class="item" href="{% url 'account_logout' %}">{% trans "Log out" %}</a>
                </div>
              </div>
            {% else %}
                <a class="item" href="{% url 'account_login' %}">{% trans "Login" %}</a>
                <a class="item" href="{% url 'account_signup' %}">{% trans "Register" %}</a>
            {% endif %}
          </div>
        </div>
      </div>
      <div class="mobile only narrow row">
        <div class="ui large fluid navbar menu">
          <a href="" class="brand item">Amiibofindr</a>
          <div class="right menu">
            <a href="#" class="item toggle-menu">
              <i class="sidebar icon"></i>
            </a>
          </div>
        </div>
        <div class="ui vertical menu responsive-menu">
          {% if user.is_authenticated %}
            <div class="ui item">
              {{ user_display }}
              <div class="menu">
                <a class="item" href="{% url 'profile:main' user.username %}">{% trans "My public profile" %}</a>
                <a class="item" href="{% url 'account_change_password' %}">{% trans "Change password" %}</a>
                <a class="item" href="{% url 'account_email' %}">{% trans "Emails" %}</a>
                <a class="item" href="{% url 'socialaccount_connections' %}">{% trans "Social accounts" %}</a>
                <a class="item" href="{% url 'account_logout' %}">{% trans "Log out" %}</a>
              </div>
            </div>
          {% else %}
            <div class="ui item">
              <div class="menu">
                <a class="item" href="{% url 'account_login' %}">{% trans "Login" %}</a>
                <a class="item" href="{% url 'account_signup' %}">{% trans "Register" %}</a>
              </div>
            </div>
          {% endif %}
          <div class="ui item">
            <div class="text">{% trans 'Figures' %}</div>
            <div class="menu">
              <a class="item" href="{% url 'amiibo:figures-all' %}">{% trans "All" %}</a>
              {% for col in COLLECTIONS_FIGURES %}
                <a class="item" href="{{ col.get_absolute_url_figures }}">{{ col.name }}</a>
              {% endfor %}
            </div>
          </div>
          <div class="ui item">
            <div class="text">{% trans "Cards" %}</div>
            <div class="menu">
              <a class="item" href="{% url 'amiibo:cards-all' %}">{% trans "All" %}</a>
              {% for col in COLLECTIONS_CARDS %}
                <a class="item" href="{{ col.get_absolute_url_cards }}">{{ col.name }}</a>
              {% endfor %}
            </div>
          </div>
        </div>
      </div>
      <div class="ui breadcrumb">
        {% block breadcrumb %}{% if section %}<strong>Amiibofindr</strong>{% endif %}{% endblock %}
      </div>
    </div>

    {% if messages %}
      <div class="ui page grid">
        <div class="sixteen wide column">
          {% for message in messages %}
            <div class="ui message {{ message.tags }}">{{ message }}</div>
          {% endfor %}

        </div>
      </div>
    {% endif %}

    {% block main_content %}{% endblock %}
    <hr />
    <div class="ui stackable page grid">
      <div class="four wide column">
        <h4>{% trans "Select desired currency" %}</h4>
        <div class="ui link list">
          {% for currency in CURRENCIES %}
            <a class="item" href="#" data-currency-change="{{ currency }}">{{ currency }}</a>
          {% endfor %}
          <a class="item" href="#" data-currency-change="reset">{% trans 'No convert' %}</a>
        </div>
      </div>
      <div class="four wide column left aligned">
        <h4>{% trans "Language" %}</h4>

        <div class="ui link list">
          {% for language in LANGUAGES %}
            {% language language.code %}
            <a class="item {% if language.code == LANGUAGE_CODE %}active{% endif %}"
               href="{{ language.url }}">{{ language.name }}</a>
            {% endlanguage %}
          {% endfor %}
        </div>
      </div>
      <div class="four wide column left aligned"></div>
      <div class="four wide column left aligned">
        <h4>AmiiboFindr</h4>
        <div class="ui link list">
          <a class="item" href="https://twitter.com/amiibofindr" target="_blank"><i class="ui icon twitter"></i>Twitter</a>
          <a class="item" href="https://www.facebook.com/amiibofindr" target="_blank"><i class="ui icon facebook"></i>Facebook</a>
          <a class="item" href="mailto:amiibofindr@fmartingr.com"><i class="ui icon envelope"></i> Email</a>
        </div>
      </div>
    </div>
    {% if not DEBUG %}
      <script>
       (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
           (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
       })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
       ga('create', 'UA-64407848-1', 'auto');
       ga('send', 'pageview');
      </script>
    {% endif %}
    <script type="text/javascript">
     var DEBUG = {{ DEBUG|yesno:"true,false" }};
     var MEDIA_URL = '{{ MEDIA_URL }}';
     var CURRENCIES = ['{{ CURRENCIES|join:"', '" }}'];
    </script>
    <script type="text/javascript" src="{% static "dist/app.js" %}" async defer></script>
  </body>
</html>
