{% extends "admin/settings.html" %}
{% load djblets_utils i18n %}

{% block scripts-post %}
{{block.super}}
<script type="text/javascript">
  function updateAuthFormDisplay() {
      var selection = $("#id_auth_backend").get(0);
      var backend = selection.options[selection.selectedIndex].value;

      $("fieldset[id^=fieldset_auth_]").hide();
      $("#fieldset_auth_" + backend).show();
  }

  $(document).ready(function() {
      $("#id_auth_backend")
          .change(updateAuthFormDisplay)
          .triggerHandler("change");
  });
</script>
{% endblock %}

{% block form_content %}
{{block.super}}

{%  for auth_form_id, auth_form in form.auth_backend_forms.items %}
<fieldset class="module aligned wide hidden" id="fieldset_auth_{{auth_form_id}}">
{%   spaceless %}
<h2>
{%    if auth_form.Meta.title %}
{{auth_form.Meta.title}}
{%    else %}
{%     blocktrans with auth_form_id|upper as auth_name %}
{{auth_name}} Authentication Settings
{%     endblocktrans %}
{%    endif %}
</h2>
{%   endspaceless %}
{%   if auth_form.Meta.description %}
 <div class="description">
  {{auth_form.description|paragraphs}}
 </div>
{%   endif %}
{%   with auth_form as form %}
{%    include "djblets_forms/admin/form_fieldsets.html" %}
{%   endwith %}
</fieldset>
{%  endfor %}
{% endblock %}
