{% extends 'generic/object_detail.html' %}
{% load helpers %}

{% block extra_buttons %}
        {% if perms.extras.change_gitrepository %}
            <form class="form-inline" style="display: inline-block"
                  method="post" action="{% url 'extras:gitrepository_dryrun' pk=object.pk %}">
                {% csrf_token %}
                <button type="submit" class="btn btn-info">
                    <i class="mdi mdi-book-refresh" aria-hidden="true"></i> Dry-Run
                </button>
            </form>
            <form class="form-inline" style="display: inline-block"
                  method="post" action="{% url 'extras:gitrepository_sync' pk=object.pk %}">
                {% csrf_token %}
                <button type="submit" class="btn btn-primary">
                    <i class="mdi mdi-source-branch-sync" aria-hidden="true"></i> Sync
                </button>
            </form>
        {% endif %}
{% endblock extra_buttons %}

{% block extra_nav_tabs %}
        <li role="presentation"{% if active_tab == 'result' %} class="active"{% endif %}>
             <a href="{% url 'extras:gitrepository_result' pk=object.pk %}">Synchronization Status</a>
        </li>
{% endblock extra_nav_tabs %}

{% block content_left_page %}
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Repository Details</strong>
                </div>
                <table class="table table-hover panel-body attr-table">
                    <tr>
                        <td>Remote URL</td>
                        <td>{{ object.remote_url }}</td>
                    </tr>
                    <tr>
                        <td>Branch</td>
                        <td>
                            <code>{{ object.branch }}</code>
                            {% if object.current_head %}
                                (checked out locally at commit <code>{{ object.current_head }}</code>)
                            {% else %}
                                (not locally checked out yet)
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>Secrets Group</td>
                        <td>{{ object.secrets_group|hyperlinked_object }}</td>
                    </tr>
                </table>
            </div>
{% endblock content_left_page %}

{% block content_right_page %}
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Provided Data Types</strong>
                </div>
                <table class="table table-hover panel-body">
                    {% for entry in datasource_contents %}
                        <tr>
                            <td>
                                <span style="display: inline-block" class="label label-info">
                                    <i class="mdi {{ entry.icon }}"></i>
                                </span>
                                {{ entry.name|title }}</td>
                            <td>
                                {% if entry.content_identifier in object.provided_contents %}
                                    {{ True | render_boolean }}
                                {% else %}
                                    {{ False | render_boolean }}
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
{% endblock %}
