{% extends "base.html" %}

{% block styles %}

    {{ super() }}
    <link href="{{ url_for('static', filename='index/_base.css') }}" rel="stylesheet">

{% endblock %}

{% block content %}

    <div class="page-header"><h3>Scrapymon</h3></div>

    {{ super() }}

    <ul class="nav nav-tabs">

        {% if request.path == url_for('index.projects_dash') %}

            <li role="presentation" class="active"><a href="#">Projects</a></li>
            <li role="presentation"><a href="{{ url_for('index.jobs_dash') }}">Jobs</a></li>

        {% elif request.path == url_for('index.jobs_dash') %}

            <li role="presentation"><a href="{{ url_for('index.projects_dash') }}">Projects</a></li>
            <li role="presentation" class="active"><a href="#">Jobs</a></li>

        {% else %}

            <li role="presentation"><a href="{{ url_for('index.projects_dash') }}">Projects</a></li>
            <li role="presentation"><a href="{{ url_for('index.jobs_dash') }}">Jobs</a></li>
            <li role="presentation" class="active"><a href="#">Logs</a></li>

        {% endif %}
    </ul>
{% endblock %}

{% block scripts %}

    {{ super() }}
    <script src="{{ url_for('static', filename='index/_base.js') }}"></script>
    <script>
    $(document).ready(function () {
        // Schedule spider run.
        $('[role="schedule"]').click(function () {
            $.get(this.id, function () {
                window.location = location.href;
            });
        });
        // Cancel job.
        $('[role="cancel"]').click(function () {
            $.get(this.id, function () {
                window.location = location.href;
            });
        });
        // Delete project or a specific version.
        $('[role="delete"]').click(function () {
            $.get(this.id, function () {
                window.location = location.href;
            });
        });
        // Get job jog .
        $('[role="logs"]').click(function () {
            window.location = this.id;
        });
    })

    </script>

{% endblock %}