{% extends "djblets_forms/admin/base_site.html" %}
{% load djblets_images djblets_utils i18n integrations pipeline staticfiles %}


{% block title %}
{%  trans "Manage Integrations" %}
{{block.super}}
{% endblock title %}


{% block admin_css %}
{%  stylesheet "djblets-integrations" %}
{% endblock admin_css %}


{% block bodyclass %}{{block.super}} change-list integrations-list-page{% endblock %}


{% block content %}
<h1 class="title">{% trans "Manage Integrations" %}</h1>

<div id="content-main">
 <div id="changelist" class="module">
  <form id="integration_manager" method="POST" action=".">
   <ul id="integration_list">
{%  for integration_info in integrations %}
    <li>
{%   if integration_info.icons.1x %}
     <img class="integration-icon"
          src="{{integration_info.icons.1x}}"
          srcset="{% srcset integration_info.icons %}"
          width="48" height="48" alt="" />
{%   endif %}
     <div class="integration-details">
      <div class="integration-name">{{integration_info.name}}</div>
      <div class="integration-description">{{integration_info.description}}</div>
      <ul class="object-tools">
       <li>
        <a href="{% url 'integration-add-config' integration_info.id %}" class="add-config-action"><span class="fa fa-plus" aria-hidden="true"></span> {% trans "Add a new configuration" %}</a>
       </li>
      </ul>
      <ul class="integration-configs">
{%   for config in integration_info.configs %}
       <li class="integration-config-{% if config.enabled %}enabled{% else %}disabled{% endif %}">
{%    render_integration_config_status integration_info.instance config %}
       </li>
{%   endfor %}
      </ul>
     </div>
    </li>
{%  empty %}
    <li class="integrations-list-empty">
{%   block integrations_list_empty %}
     {% trans "There are no integrations installed." %}
{%   endblock integrations_list_empty %}
    </li>
{%  endfor %}
   </ul>
  </form>
 </div>
</div>
{% endblock content %}
