{% extends tabbed_admin_base_template|default:"admin/change_form.html" %} {% load tabbed_admin_tags %} {% block field_sets %} {% if tabs.fields %}
{% for tab in tabs.fields %}
{% for entry in tab.entries %} {% render_tab_fieldsets_inlines entry %} {% endfor %}
{% endfor %}
(function($) { $('#tabs').tabs({ {% if add %}active: false{% endif %} }); const enabled_tabs = []; const disabled_tabs = []; {% for tab in page_config %} {% if tab.enabled %} enabled_tabs.push({{ forloop.counter0 }}); {% else %} disabled_tabs.push({{ forloop.counter0 }}); {% endif %} {% endfor %} for (let i = 0; i < disabled_tabs.length; i++) { $('#tabs').tabs('disable', disabled_tabs[i]); } {% if add %} $('#tabs').tabs('option', 'active', enabled_tabs.length ? enabled_tabs[0] : {% if page_config %}false{% else %}0{% endif %}); {% endif %} $('#tabs > div').each(function() { if ($(this).find('.errorlist').length) { $('#tabs #for_' + this.id).addClass('errortab'); } }); $('#tabs').on('tabsactivate', function(event, ui) { const scrollPos = $(window).scrollTop(); const hash = ui.newTab.find('a').attr('href'); if (hash) window.location.hash = hash; $(window).scrollTop(scrollPos); }); if ($('.errornote').length) { $('.errornote').addClass('tabbed-errornote'); } })(django.jQuery); {% else %} {{ block.super }} {% endif %} {% endblock %} {% block inline_field_sets %} {% if not tabs.fields %}{{ block.super }}{% endif %} {% endblock %}