{% load i18n wagtailadmin_tags %}
{% include "wagtailadmin/shared/header.html" with title=title icon=icon merged=1 %}
{# TODO: drop data-wmtabs and the tabs.js include once we drop support for Wagtail < 7.1 #}
{% if uploadforms %}
{# Both auth and video forms are powered by the same media form, so use one of them #}
{% if uploadforms.video %}
{{ uploadforms.video.media.js }}
{{ uploadforms.video.media.css }}
{% else %}
{{ uploadforms.audio.media.js }}
{{ uploadforms.audio.media.css }}
{% endif %}
{# Using nice-padding and full width class until the modal header is restyled #}
{% trans "Search" as search_text %}
{% include 'wagtailadmin/shared/tabs/tab_nav_link.html' with tab_id='search' title=search_text %}
{% if uploadforms.audio %}
{% trans "Upload Audio" as upload_audio_text %}
{% if uploadforms.audio.errors and media_type == 'audio' %}
{% include 'wagtailadmin/shared/tabs/tab_nav_link.html' with tab_id='upload-audio' title=upload_audio_text errors_count=uploadforms.audio.errors|length %}
{% else %}
{% include 'wagtailadmin/shared/tabs/tab_nav_link.html' with tab_id='upload-audio' title=upload_audio_text %}
{% endif %}
{% endif %}
{% if uploadforms.video %}
{% trans "Upload Video" as upload_video_text %}
{% if uploadforms.video.errors and media_type == 'video' %}
{% include 'wagtailadmin/shared/tabs/tab_nav_link.html' with tab_id='upload-video' title=upload_video_text errors_count=uploadforms.video.errors|length %}
{% else %}
{% include 'wagtailadmin/shared/tabs/tab_nav_link.html' with tab_id='upload-video' title=upload_video_text %}
{% endif %}
{% endif %}
{% endif %}
{% include "wagtailmedia/chooser/results.html" %}
{% if uploadforms %}
{% for form_type, uploadform in uploadforms.items %}
{% include "wagtailadmin/shared/non_field_errors.html" with form=uploadform %}
{% endfor %}
{% endif %}