{% load static future %}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Dashboard</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Place favicon.ico and apple-touch-icon(s) in the root directory -->

        <link rel="stylesheet" href="{% static "dashboard_app/css/libs/bootstrap.css" %}">
        <link rel="stylesheet" href="{% static "dashboard_app/css/styles.css" %}">
    </head>
    <body>
        <!--[if lt IE 8]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->

        <!-- Add your site or application content here -->
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    {% for widget_name, widget, position in widgets %}
                        {% cycle "col1" "col2" "col3" as column silent %}
                        {% if column == "col1" %}
                            <div class="row">
                        {% endif %}

                                <div class="col-md-4">
                                    {% include widget.template_name with widget=widget %}
                                </div>

                        {% if column == "col3" or forloop.last %}
                            </div>
                        {% endif %}
                    {% empty %}
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">No widgets found</h3>
                            </div>
                            <div class="panel-body">
                                Whoops! Looks like you have not registered any widget, yet.
                            </div>
                        </div>
                    {% endfor %}
                </div>
            </div>
        </div>

        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="{% static "dashboard_app/js/libs/jquery-1.11.0.min.js" %}"><\/script>')</script>
        <script src="{% static "dashboard_app/js/libs/bootstrap.min.js" %}"></script>
        <script>
            var get_last_updates_url = '{% url "dashboard_app_get_last_updates" %}';
            var render_widget_url = '{% url "dashboard_app_render_widget" %}';
        </script>
        <script src="{% static "dashboard_app/js/dashboard.js" %}"></script>
    </body>
</html>
