{% extends "sentry/projects/manage.html" %}

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

{% block title %}{{ plugin.get_title }}{% endblock %}

{% block main %}
    <div class="pull-right">
        {% if plugin.can_disable %}
            {% if not plugin_is_enabled %}
                <form method="post" action="{% url 'sentry-enable-project-plugin' project.organization.slug project.slug plugin.slug %}"
                      style="display:inline">
                    {% csrf_token %}
                    <button type="submit" class="btn btn-default">{% trans "Enable Plugin" %}</button>
                </form>
            {% else %}
                <form method="post" action="{% url 'sentry-disable-project-plugin' project.organization.slug project.slug plugin.slug %}"
                      style="display:inline">
                    {% csrf_token %}
                    <button type="submit" class="btn btn-danger">{% trans "Disable Plugin" %}</button>
                </form>
            {% endif %}
        {% endif %}
        <form method="post" action="{% url 'sentry-reset-project-plugin' project.organization.slug project.slug plugin.slug %}"
              style="display:inline"
              onsubmit="return confirm('{% trans "Are you sure you wish to reset all configuration for this plugin?" %}');">
            {% csrf_token %}
            <button type="submit" class="btn btn-default">{% trans "Reset Configuration" %}</button>
        </form>
    </div>
    <h2>{{ plugin.get_title }}</h2>
    <hr>
    <div class="row">
        <div class="col-md-7">
            {% if request.GET.success %}
                <div class="alert alert-success">
                    {% trans "Changes to your project were saved successfully." %}
                    <a class="close" data-dismiss="alert" href="javascript:void(0)">&times;</a>
                </div>
            {% endif %}
            {{ view }}
        </div>
        <div class="col-md-4 col-md-offset-1">
            <div class="plugin-meta">
                <h4>Plugin Information</h4>
                <dl class="flat">
                    <dt>Name:</dt>
                    <dd>{{ plugin.get_title }}</dd>
                    <dt>Author</dt>
                    <dd>{{ plugin.author }}</dd>
                    {% if plugin.author_url %}
                        <dt>URL</dt>
                        <dd><a href="{{ plugin.author_url }}">{{ plugin.author_url|trim_schema }}</a></dd>
                    {% endif %}
                    <dt>Version</dt>
                    <dd>{{ plugin.version }}</dd>
                </dl>
                {% if plugin_description %}
                    <h4>Description</h4>
                    <div class="description">
                        {{ plugin_description|linebreaks }}
                    </div>
                {% endif %}
                {% with plugin.get_resource_links as resource_links %}
                    {% if resource_links %}
                        <h4>Resources</h4>
                        <dl class="flat">
                            {% for label, link in resource_links %}
                                <dd><a href="{{ link }}">{{ label }}</a></dd>
                            {% endfor %}
                        </dl>
                    {% endif %}
                {% endwith %}
            </div>
        </div>
    </div>
{% endblock %}
