{% load i18n %}
{% load sentry_helpers %}
{% load static_compiler %}

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="robots" content="NONE,NOARCHIVE">

        <link href="{% url sentry-media "sentry" "images/favicon.png" %}" rel="shortcut icon" type="image/png"/>

        {% block css %}
            {% staticbundle 'sentry/styles/global.min.css' %}
        {% endblock %}

        <title>{% block title %}Sentry{% endblock %}</title>

        <!--[if lt IE 9]>
        <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/html5shiv.js" %}"></script>
        <![endif]-->
        {% block scripts %}
            {% staticbundle 'sentry/scripts/lib.min.js' %}
            {% staticbundle 'sentry/scripts/global.min.js' %}
            {% staticbundle 'sentry/scripts/legacy.min.js' %}
            <script type="text/javascript">
            app.config.popupCss = '{% url sentry-media "sentry" 'styles/popup.css' %}';
            app.config.popupCss = '{% url sentry-media "sentry" 'styles/popup.css' %}';
            app.config.mediaUrl = '{% url sentry-media "sentry" '' %}';
            app.config.urlPrefix = {{ URL_PREFIX|to_json|safe }};
            app.config.hasRealtime = {{ hasRealtime|to_json|safe  }};
            app.config.projectId = {{ project.slug|to_json|safe }};
            app.config.teamId = {{ team.slug|to_json|safe }};
            app.config.viewId = {% if view %}{{ view.pk|to_json|safe }}{% else %}null{% endif %};
            </script>
        {% endblock %}

        {% if USE_JS_CLIENT and INTERNAL_PROJECT %}
            <script type="text/javascript" src="{% url sentry-media "sentry" "scripts/lib/raven.js" %}"></script>
            <script type="text/javascript">
            Raven.config({{ INTERNAL_PROJECT.dsn|to_json|safe }});
            window.onerror = Raven.process;
            </script>
        {% endif %}

        {% block meta %}
        {% endblock %}
    </head>

    <body>
        <div class="outer-wrapper">
        {% block body %}
        {% block header %}
            {% include "sentry/header.html" %}
        {% endblock %}
        {% block page_header_block %}
            <section id="page-header" class="toolbar">
                <div class="container">
                    {% block page_header %}
                        <ul class="breadcrumb">
                            <li><a href="{% url sentry %}" class="dashboard-btn" title="{% trans "Dashboard" %}"><i aria-hidden="true" class="icon-list"></i></a></li>
                            <li class="projects">
                                <select class="project-selector" data-placeholder="{% trans "Select a Project" %}">
                                    <option value=""></option>
                                    {% for p in PROJECT_LIST %}
                                        <option value="{{ p.slug }}"{% if p == project %} selected="selected"{% endif %} data-url="{% url sentry-stream p.team.slug p.slug %}">{{ p.name }}</option>
                                    {% endfor %}
                                </select>
                            </li>
                            {% if project and can_admin_team %}
                                <li class="project-settings"><a href="{% url sentry-manage-project project.team.slug project.slug %}" class="{% trans "Settings" %}"><i aria-hidden="true" class="icon-cog"></i></a></li>
                            {% endif %}
                            {% block breadcrumb %}
                            {% endblock %}
                        </ul>
                    {% endblock %}
                </div>
            </section>
        {% endblock %}
        <section id="content" class="{% block bodyclass %}with-sidebar{% endblock %}">
            <div class="container">
                {% block above_content %}{% endblock %}
                <div class="content">
                    {% block content_before %}
                    {% endblock %}

                    {% block content %}
                        <div class="main">
                            {% block alerts %}
                                {% include "sentry/partial/alerts.html" %}
                            {% endblock %}

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

                        <div class="sidebar">
                            {% block sidebar %}
                            {% endblock %}
                        </div>
                    {% endblock %}

                    {% block content_after %}
                    {% endblock %}
                    </div>
                </div>
            </div>
        </section>
        <footer>
            <div class="container">
                {% block footer %}
                    <div class="contribute">Sentry is open source software <a href="https://github.com/getsentry/sentry" class="btn btn-small">Contribute</a></div>
                    <div class="version">Sentry {% sentry_version %}</div>
                    <div class="credits">Created by the <a href="http://code.disqus.com">DISQUS</a> team with <a href="https://github.com/getsentry/sentry/contributors">lots of help</a></div>
                {% endblock %}
            </div>
        </footer>
        {% endblock %}
        <div class="modal" id="modal" style="display:none">
          <div class="modal-header">
            <a class="close" data-dismiss="modal">×</a>
            <h3></h3>
          </div>
          <div class="modal-body">
          </div>
        </div>
        </div>

        <script type="text/javascript">
        $(function(){
            $('.clippy').clippy({
                clippy_path: '{% url sentry-media "sentry" "clippy.swf" %}',
                keep_text: true
            });
            $('input[data-toggle="datepicker"]').datepicker();
            $('.tip').tooltip();
            $('.nav-tabs .active a').tab('show')
            $('.project-selector').on('change', function(e){
                var $el = $(e.target).get(0);
                var $opt = $($el.options[$el.selectedIndex]);
                window.location.href = $opt.attr('data-url');
                return false;
            });
        });
        </script>
    </body>
</html>
