Exclude the error messages from the count of inline panel elements (#4957)

Ref #4304 ; explicitly identify and count inline-panel-child elements as per https://github.com/wagtail/wagtail/pull/4304#discussion_r169149310
pull/4963/head
Matt Westcott 2018-12-14 17:44:46 +00:00
rodzic 5f7b7230a2
commit a11f7ee015
4 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -4,7 +4,8 @@ Changelog
2.5 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~
* Fix: Set `SERVER_PORT` to 443 in `Page.dummy_request()` for HTTPS sites (Sergey Fedoseev)
* Fix: Set `SERVER_PORT` to 443 in `Page.dummy_request()` for HTTPS sites (Sergey Fedoseev)
* Fix: Validation error messages in `InlinePanel` no longer count towards `max_num` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)
2.4 (xx.xx.xxxx) - IN DEVELOPMENT

Wyświetl plik

@ -19,6 +19,7 @@ Bug fixes
~~~~~~~~~
* Set ``SERVER_PORT`` to 443 in ``Page.dummy_request()`` for HTTPS sites (Sergey Fedoseev)
* Validation error messages in ``InlinePanel`` no longer count towards ``max_num`` when disabling the 'add' button (Todd Dembrey, Thibaud Colas)
Upgrade considerations

Wyświetl plik

@ -176,7 +176,7 @@ function InlinePanel(opts) {
self.updateAddButtonState = function() {
if (opts.maxForms) {
var forms = $('> li', self.formsUl).not('.deleted');
var forms = $('> [data-inline-panel-child]', self.formsUl).not('.deleted');
var addButton = $('#' + opts.formsetPrefix + '-ADD');
if (forms.length >= opts.maxForms) {

Wyświetl plik

@ -1,5 +1,5 @@
{% load i18n %}
<li id="inline_child_{{ child.form.prefix }}">
<li data-inline-panel-child id="inline_child_{{ child.form.prefix }}">
<ul class="controls">
{% if can_order %}
<li><button type="button" class="button icon text-replace white icon-order-up inline-child-move-up" id="{{ child.form.prefix }}-move-up" title="{% trans 'Move up' %}">{% trans "Move up" %}</button></li>