{% load kegweblib %}
{% load humanize %}
{% if USE_FACEBOOK %}{% load facebook_tags %}{% endif %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>kegbot :: {% block title %}Default Page{% endblock %}</title>

  <link rel="icon" type="image/png" href="{{ STATIC_URL}}images/kegbot-icon-72x72.png" />
  <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/kegweb.css" media="screen"/>
  <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fancybox/jquery.fancybox-1.3.4.css" media="screen" />

  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load("jquery", "1");
    google.load("jqueryui", "1");
  </script>

  <script type="text/javascript" src="{{ STATIC_URL }}js/kegweb.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-dropdown.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-alerts.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-buttons.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-tabs.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-twipsy.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap-popover.js"></script>

  {% if kbsite.url %}
  <script>
    kegweb.API_BASE = "/{{ kbsite.url }}/api/";
  </script>
  {% endif %}

  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.cookie.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.timeago.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.autounits.js"></script>
  <script type="text/javascript">
    $(document).ready(function() {
        var defaultUseMetric = {% if kbsite.settings.display_units != 'metric' %}false{% else %}true{% endif%};
        kegweb.refreshDisplayUnits(defaultUseMetric);
        kegweb.onReady();
        $("abbr.timeago").timeago();
        $(".tabs").tabs();
        $(".pills").pills();
        $(".alert-message").alert()
    });
  </script>

  <script type="text/javascript" src="{{ STATIC_URL }}highcharts/js/highcharts.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}fancybox/jquery.fancybox-1.3.4.pack.js"></script>
  <script type="text/javascript" src="{{ STATIC_URL }}fancybox/jquery.mousewheel-3.0.4.pack.js"></script>

  <style>
    body {
  {% if kbsite %}{% if kbsite.settings.background_image %}
      background-image: url({{kbsite.settings.background_image.image.url}});
  {% else %}
      background-image: url({{ STATIC_URL }}images/background.png);
  {% endif %} {% endif %}
      background-repeat: no-repeat;
      background-attachment: fixed;
    }
  </style>

  {% block kb-extrajs %}{%endblock%}
</head>

<body>
  <div class="topbar">
    <div class="fill">
      <div class="container">
        <a class="brand" href="{% url kb-home kbsite.url %}">{% spaceless %}
          {% if kbsite.settings.title %}
            {{kbsite.settings.title}}
          {% else %}
            kegbot beer device
          {% endif %}
        {% endspaceless %}</a>
        <ul class="nav">
          {% navitem kb-kegs "Kegs" %}
          {% navitem kb-stats "Stats" %}
          {% if user.is_authenticated %}{% navitem kb-account-main "Account" %}{% endif %}
          {% if user.is_staff %}
            <li class="dropdown" data-dropdown="dropdown">
              <a class="dropdown-toggle" href="{% url kegadmin-main kbsite.url %}">Admin</a>
              <ul class="dropdown-menu">
                {% include "kegadmin/nav-items.html" %}
              </ul>
            </li>
          {% endif %}
        </ul>
        {% if not user.is_authenticated %}
        <form action="/accounts/login/" class="pull-right" method="POST">
        {% csrf_token %}
        {% with login_form as form %}
          {% for hidden in form.hidden_fields %}
          {{ hidden }}
          {% endfor %}
        {% endwith %}
          <input class="input-small" name="username" type="text" placeholder="Username" >
          <input class="input-small" name="password" type="password" placeholder="Password">
          <button class="btn" type="submit">Sign in</button>
        </form>
        {% else %}
          <ul class="nav secondary-nav">
            <li class="dropdown" data-dropdown="dropdown">
              <a href="#" class="dropdown-toggle">
                {{ user.username }}
              </a>
              <ul class="dropdown-menu">
                <li><a href="{% url django.contrib.auth.views.logout %}">Logout</a></li>
              </ul>
            </ul>
          </ul>
        {% endif %}
      </div>
    </div>
  </div>

  <div class="container-fluid">
    <div class="sidebar">
      {% block sidebar %}{% endblock %}
    </div>
    <div class="content">
      {% block header-margin %}
      <div class="page-header">
        <h1>{% block pagetitle %}{% endblock %}</h1>
        {% for message in messages %}
          <div class="alert-message {{message.tags}}">
            <a class="close" href="#">×</a>
            <p>
              {{message}}
            </p>
          </div>
        {% endfor %}
      </div>
      {% endblock %}

      {% block content %}{% endblock %}
      {% block extra-content %}{% endblock %}
    </div> <!-- content -->

    <footer>
      <p>
        <small>
        this site is powered by <a href="http://kegbot.org/">kegbot</a>:
        &copy; 2003-{% now "Y" %} mike wakerly<br>

        <span id="units-selector"></span> |
        charts by <a href="http://highcharts.com/" target="_blank">highcharts</a>
        </small>
      </p>
    </footer>

  </div> <!-- container -->
</body>

