{% extends "two.bootstrap/base.html" %}
{% load url from future %}
{% load i18n %}
{% load topnav %}
{% load fragments %}
{% load staticfiles %}

{% block htmltitle %}
<title>{{page_title}}</title>
{% endblock %}
{% block bootstrapcss %}
    {{config.themeinfo.css|safe}}
    <link rel="stylesheet" href="{% static "css/bootstrap-responsive.min.css" %}" media="screen, projection, print"/>
    <link rel="stylesheet" href="{% static "css/twool-bootstrap.css" %}" media="screen, projection, print"/>
    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
        }
    </style>

{% endblock %}

{% block bootstrapjs %}
    <script src="{% static "js/jquery-1.7.min.js" %}"></script>
    {{config.themeinfo.js|safe}}
{% endblock %}

{% block base_stylesheets %}
    <link rel="stylesheet" href="{% static "css/wheel.css" %}" media="screen, projection, print"/>
    <link rel="stylesheet" href="{% static "css/wheel_content.css" %}" media="screen, projection, print"/>
{% endblock %}

{% block meta_head %}
    <!-- {{settings.BUILD}} {{settings.BRANCH}} {{settings.VERSION }} -->
    <meta name="generator" content="WheelCMS {{settings.VERSION}}">

   {% fragments "head" %}
{% endblock %}
{% block extra_head %}

{{config.head|safe}}

  {% if config.analytics.strip %}
  <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{{config.analytics}}']);
    _gaq.push(['_trackPageview']);
  
    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
  </script>
  {% endif %}
{% endblock %}

{% block topbar %}
{% block logo %}
<a class="brand" href="{{root.get_absolute_url}}">{{config.title}}</a>
{% endblock %}

<div class="nav-collapse">
  {% topnav %}
  {% block searchnav %}
  <form class="navbar-search pull-right" action="{% url "haystack_search" %}">
    <input type="text" name="q" class="search-query span3" placeholder="Search">
    <div class="icon-search"></div>
  </form>
  {% endblock %}
  <div class="pull-right">
    {% block rightnav %}
    <ul class="nav">
      <li><a href="{{root.get_absolute_url}}+contact">Contact</a></li>
    </ul>
    {% endblock %}
    {% block right_signin_nav %}
    {% if not user.is_authenticated %}
    <ul class="nav">
      {% if settings.ALLOW_SIGNUP %}
      <li><a href="{% url "userena_signup" %}">Register</a></li>
      {% endif %}
      {# issue 576 - do not redirect to logout page #}
      {% if not is_logout_url %}
      <li><a href="{% url "userena_signin" %}?next={{request.path}}">Signin</a></li>
      {% else %}
      <li><a href="{% url "userena_signin" %}?next=/">Signin</a></li>
      {% endif %}

    </ul>
    {% else %}
    <ul class="nav">
      <li class="dropdown">
          <a href="/" data-target="#" class="dropdown-toggle" data-toggle="dropdown">{{user.email}} <b class="caret"></b></a>
          <ul class="dropdown-menu" role="menu">
            {# <li><a href="{{root.get_absolute_url}}"><i class="icon-cog"></i> Preferences</a></li> #}

            <li><a href="{% url "userena_profile_detail" user.username %}"><i class="icon-user"></i> Profile</a></li>
            <li class="divider"></li>
            <li><a href="{% url "userena_signout" %}"><i class="icon-off"></i> Logout</a></li>
          </ul>
      </li>
    </ul>
    {% endif %}
    {% block language_selector %}
      {# language selection #}
      {% with langdata=languages %}
        {% if langdata %}
        <ul class="nav">
          <li class="dropdown">
              <a href="/" data-target="#" class="dropdown-toggle" data-toggle="dropdown"> {% trans "language_switch_language" %}: {{ langdata.current.label }} <b class="caret"></b></a>
              <ul class="dropdown-menu" role="menu">
                 {% for lang in langdata.languages %}
                   {% if not lang.is_current %}
                     <li><a href="{{lang.url}}">{{lang.label}}</a>
                   {% endif %}
                 {% endfor %}
              </ul>
          </li>
        </ul>
        {% endif %}
      {% endwith %}
    {% endblock %}

    {% endblock %}
  </div>
</div>
{% endblock %}

{% block base_javascript %}
    <script src="{% static "js/jquery-ui-1.9.2.custom.min.js" %}"></script>
    <script src="{% static "js/jquery.cookie.1.3.1.js" %}"></script>
    <script src="{% static "js/wheel.js" %}"></script>
    <script type="text/javascript" src="{% static "tiny_mce/tiny_mce.js" %}"></script>

{% endblock %}

{% block body_class %}{{body_class}}{%endblock %}
{% block bodytop %}
{% if user.is_authenticated %}
{% include "wheelcms_axle/toolbar.html" %}
{% endif %}
{% endblock %}

{% block base_main %}
      <div class="row">
        <div class="span12">
          {% block main %}
          {% endblock %}
        </div>
      </div>
      <div class="row">
        <div class="span12">
          {% block comments %}
          {% endblock %}
        </div>
      </div>
{% endblock %}

{% block base_footer %}
<div class="pull-right">Powered by <a href="http://wheelcms.io/">WheelCMS</div></div>
{% endblock %}


