<!doctype html>
<html>
  <head>
    <title>SQLite Web: {{ dataset.base_name }}</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="noindex">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/bootstrap.min.css') }}" />
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/sqlbrowse.css') }}" />
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/syntax-highlight.css') }}" />
    <style type="text/css">
      @media (max-width: 1200px) {
        h1 { font-size: 1.7rem; }
        h1 small { font-size: .7rem; }
        h3 { font-size: 1.2rem; }
        ul.nav li { font-size: .9rem; }
      }
    </style>
    {% block extra_head %}{% endblock %}
    <script src="{{ url_for('static', filename='js/jquery-1.11.0.min.js') }}" type="text/javascript"></script>
    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/app.js') }}" type="text/javascript"></script>
    <script type="text/javascript">
      $(function() {
        App.initialize();
      });
    </script>
    {% block extra_scripts %}{% endblock %}
  </head>

  <body class="{% block body_class %}{% endblock %}">
    <div class="container-fluid">
      {% block page_header %}
        <div class="page-header">
          {% block content_header %}
            {% if dataset.is_readonly %}
              <a class="btn btn-sm btn-secondary float-right" href="{{ url_for('generic_query') }}">Query</a>
            {% else %}
              <form action="{{ url_for('table_create') }}" class="form-inline float-right" method="post" style="margin-top: 10px;">
                <input name="redirect" type="hidden" value="{{ request.full_path }}" />{# full-path begins with "/" and includes querystring #}
                <input class="form-control form-control-sm" name="table_name" placeholder="new_table_name" />
                <button class="btn btn-primary btn-sm" type="submit">Create</button>
                &nbsp;
                <a class="btn btn-sm btn-secondary" href="{{ url_for('generic_query') }}">Query</a>
              </form>
            {% endif %}
          {% endblock %}
          <h1>{% block content_title %}{% endblock %}</h1>
        </div>
      {% endblock %}
      <div class="row">
        <div class="col-3" id="sidebar">
          {% block sidebar %}{% endblock %}
          {% block logout %}{% if login_required %}<a href="{{ url_for('logout') }}">Log-out</a>{% endif %}{% endblock %}
        </div>
        <div class="col-9" id="content">
          {% for category, message in get_flashed_messages(with_categories=true) %}
            <div class="alert alert-{{ category }} alert-dismissable">
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
              <p>{{ message }}</p>
            </div>
          {% endfor %}
          {% block content %}{% endblock %}
        </div>
      </div>
      <div class="row">
        <div class="col-9 offset-3">
          <footer>
            <hr />
            <p>
              Web-based SQLite database browser {{ now.year }}
            </p>
          </footer>
        </div>
      </div>
    </div>
  </body>
</html>
