Fix #94. Panels are now hidden on page load if they are marked as

deleted after a form validation failure.
This commit is contained in:
Tom Talbot 2014-05-29 15:02:56 +01:00 committed by Matt Westcott
parent 2d7a276b83
commit a5072c768d
2 changed files with 12 additions and 1 deletions

View file

@ -181,6 +181,17 @@ function InlinePanel(opts) {
self.updateMoveButtonDisabledStates();
});
}
/* Hide container on page load if it is marked as deleted. Remove the error
message so that it doesn't count towards the number of errors on the tab at the
top of the page. */
if ( $('#' + deleteInputId).val() === "1" ) {
$('#' + childId).hide(0, function() {
self.updateMoveButtonDisabledStates();
self.setHasContent();
});
$('#' + childId).find(".error-message").remove();
}
};
self.formsUl = $('#' + opts.formsetPrefix + '-FORMS');

View file

@ -5,7 +5,7 @@ from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext as _
from django.views.decorators.vary import vary_on_headers
from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList