<!DOCTYPE html>
{% set is_admin = request.access.is_admin(request.authenticated_userid) %}
<html ng-app="{% block ng_app %}pypicloud{% endblock %}">
<head>
  <title>Pypicloud</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
{% block head -%}
  {%- block all_css -%}
    <link href="{{ 'pypicloud:static/css/lib/bootstrap-3.0.3.min.css' | static_url }}" rel="stylesheet">
    <link href="{{ 'pypicloud:static/css/lib/font-awesome-4.0.3/css/font-awesome.min.css' | static_url }}" rel="stylesheet">
    <link href="{{ 'pypicloud:static/css/base.css' | static_url }}" rel="stylesheet">
    {% block css %}
    {% endblock %}
  {%- endblock -%}
{%- endblock %}
</head>
<body>
{% block body %}

{% block navbar %}
<nav class="navbar navbar-default"
ng-include="'{{ 'pypicloud:static/partial/navbar.html' | static_url }}'"
role="navigation">
</nav>
{% endblock %}

<div class='container' ng-controller="BaseCtrl">
  {% block content %}
    <div ng-view></div>
  {% endblock %}
</div>

{% endblock %}
{% block all_scripts %}
  <script src="{{ 'pypicloud:static/js/lib/underscore/1.13.1/underscore-umd-min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/angularjs/1.2.14/angular.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/angularjs/1.2.14/angular-route.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/angularjs/1.2.14/angular-cookies.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/angularjs/1.2.14/angular-sanitize.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/ui-bootstrap-tpls-0.10.0.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/lib/angular-file-upload.min.js' | static_url }}"></script>
  <script src="{{ 'pypicloud:static/js/pypicloud.js' | static_url }}"></script>
  {% if is_admin %}
  <script src="{{ 'pypicloud:static/js/admin.js' | static_url }}"></script>
  {% endif %}
  <script type="text/javascript" charset="utf-8">
    var USER = {{ request.authenticated_userid | tojson | safe }};
    var IS_ADMIN = {{ is_admin | tojson | safe }};
    var ROOT = {{ request.app_url() | tojson | safe }};
    {% if request.custom_download_url %}
    var DOWNLOAD_URL = {{ request.custom_download_url | tojson | safe }};
    {% else %}
    var DOWNLOAD_URL = {{ request.app_url() | tojson | safe }};
    {% endif %}
    var STATIC = {{ 'pypicloud:static/' | static_url | tojson | safe }};
    var NEED_ADMIN = {{ request.access.need_admin() | tojson | safe }};
    var ACCESS_MUTABLE = {{ request.access.mutable | tojson | safe }};
    var ALLOW_REGISTER = {{ request.access.allow_register() | tojson | safe }};
    var ALLOW_REGISTER_TOKEN = {{ request.access.allow_register_token() | tojson | safe }};
    var VERSION = {{ request.pypicloud_version | tojson | safe }};
    var CAN_UPDATE_CACHE = {{ request.access.can_update_cache() | tojson | safe }};
    var FALLBACK_URL = {{ request.fallback_simple | tojson | safe }};
    var DEFAULT_READ = {{ request.access.default_read | tojson | safe }};
    var DEFAULT_WRITE = {{ request.access.default_write | tojson | safe }};
    var SECURE_COOKIE = {{ request.registry.secure_cookie | tojson | safe }};
    var ALLOW_DELETE = {{ request.db.allow_delete | tojson | safe }};
  </script>
  {% block scripts %}
  {% endblock %}
{% endblock %}
</body>
</html>
