{% extends "generic/object_edit.html" %}
{% load helpers %}
{% load form_helpers %}
{% load i18n %}
{% block title %}
    {{ action_text }} Authorized Keys {{ preposition }}: {{ object|meta:"verbose_name" }} {{ object }}
{% endblock title %}
{% block content %}
    <div class="tab-pane show active"
         id="edit-form"
         role="tabpanel"
         aria-labelledby="object-list-tab">
        {% if prerequisite_model %}
            {% include 'inc/missing_prerequisites.html' %}
        {% endif %}
        <form action=""
              method="post"
              enctype="multipart/form-data"
              class="object-edit mt-5">
            {% csrf_token %}
            <div id="form_fields" hx-disinherit="hx-select hx-swap">
                {% block form %}
                    <div class="field-group mb-5">
                        <div class="row mb-3">
                            {% if object %}
                                <label class="col-sm-3 col-form-label text-lg-end required">{{ object|meta:"verbose_name"|bettertitle }}</label>
                                <div class="col-sm-9">
                                    <div class="form-control-plaintext">{{ object|linkify }}</div>
                                </div>
                            {% else %}
                                <label class="col-sm-3 col-form-label text-lg-end required">object</label>
                                <div class="col-sm-9">
                                    <div class="form-control-plaintext">Missing object object</div>
                                </div>
                            {% endif %}
                        </div>
                        {% include 'htmx/form.html' %}
                    {% endblock form %}
                </div>
                <div class="btn-float-group-right">
                    {% block buttons %}
                        <a href="{{ return_url }}" class="btn btn-outline-secondary btn-float">{% trans "Cancel" %}</a>
                        <div class="btn-group" role="group" aria-label="{% trans 'Actions' %}">
                            <button type="submit" name="_create" class="btn btn-{{ button_class }}">{% trans action_text %} Authorized Keys</button>
                        </div>
                    {% endblock buttons %}
                </div>
            </form>
        </div>
    </div>
{% endblock content %}