<form id="new-subpage-form" action="." method="POST">
  <div class="field">
    <label for="field-model">{{ _('Content Type') }}</label>
    {% if (models | length) == 1 %}
    {{ models[0].name_i18n.get(g.lang_code, models[0].name) }}
    <input type="hidden" id="field-model" name="model" value="{{ models[0].id }}"/>
    {% else %}
    <select id="field-model" name="model" required>
      {% for model in models %}
      <option value="{{ model.id }}"{{ ' selected' if model.id == 'page' else '' }}>
        {{ model.name_i18n.get(g.lang_code, model.name) }}
      </option>
      {% endfor %}
    </select>
    {% endif %}
  </div>

  <div class="field">
    <label for="field-title">{{ _('Title') }}</label>
    <input type="text" id="field-title" name="title" required
        hx-get="{{ url_for('tekir_admin.api.slug_from_title') }}"
        hx-trigger="keyup delay:500ms changed"
        hx-swap="none"/>
  </div>

  <div class="field">
    <label for="field-slug">{{ _('Name') }}</label>
    <input type="text" id="field-slug" name="slug"/>
  </div>

  <button class="confirm"
      hx-post="{{ url_for('tekir_admin.api.add_subpage', parent=record.path) }}"
      hx-swap="none">{{ _('Add') }}</button>
  <button class="cancel modal-close">{{ _('Cancel') }}</button>
</form>
