{% load static %}
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">

    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/geojs/1.4.3/geo.min.js"></script>

    <script>
      var host = window.location.protocol + "//" + window.location.host;

      function setCookie(cookieName, cookieValue, nDays=365) {
        var today = new Date();
        var expire = new Date();
        if (nDays==null || nDays==0) nDays=1;
        expire.setTime(today.getTime() + 3600000*24*nDays);
        document.cookie = cookieName+"="+escape(cookieValue)
            + ";expires="+expire.toGMTString() + "; path=/";
      }

      function getCookie(cookieName, defaultValue="") {
        var theCookie=""+document.cookie;
        var ind=theCookie.indexOf(cookieName+"=");
        if (ind==-1 || cookieName=="") {
          if (defaultValue != "") {
            setCookie(cookieName, defaultValue);
          }
          return defaultValue;
        }
        var ind1=theCookie.indexOf(";",ind);
        if (ind1==-1) { ind1=theCookie.length; }
        return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
      }

      function download(url, filename) {
        fetch(url)
          .then(response => response.blob())
          .then(blob => {
            const link = document.createElement("a");
            link.href = URL.createObjectURL(blob);
            link.download = filename;
            link.click();
        })
        .catch(console.error);
      }
    </script>

    <link rel="stylesheet" href="{% static 'rgd/css/style.css' %}" />

    {% if title %}
      <title>Resonant GeoData - {{ title }}</title>
    {% else %}
      <title>Resonant GeoData</title>
    {% endif %}

    <link rel="shortcut icon" type="image/png" href="{% static 'rgd/favicon.png' %}"/>

  </head>
  <body>
    <header class="main-header">
      {% include 'rgd/_include/navbar.html' %}
    </header>

    {% if user.is_authenticated %}
    <div id="page-banner" class="px-5">
        <div class="columns is-vcentered">
          <div class="column">
            <h1 class="banner-title">{% block title %}{% endblock %}</h1>
          </div>
          {% block extra_title_content %}{% endblock %}
        </div>
    </div>
    {% endif %}

    <div class="main-content">
      {% if messages %}
        <div class="notification-wrapper">
        {% for message in messages %}
          {% if message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}
            <div class="notification is-success">
              {{ message }}
            </div>
          {% endif %}

          {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}
            <div class="notification is-danger">
              {{ message }}
            </div>
          {% endif %}
        {% endfor %}
        </div>
      {% endif %}


      <main role="main">
        {% if user.is_authenticated %}
          {% block content %}{% endblock %}
        {% else %}
          {% include 'rgd/_include/not_logged_in.html' %}
        {% endif %}
      </main>

    </div>

    {% comment %}
    <div class="help-container">
      <a class="help-button btn is-medium is-warning" href="https://forum.isic-archive.com" target="_blank">Report an Issue</a>
    </div>
    {% endcomment %}


    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

  </body>
</html>
