Fixing issue with inline panels used in non-content panels failing to display correctly due to use of :visible, which doesn't work as expected when content is already hidden at runtime

pull/652/head
Dave Cranwell 2014-09-23 10:26:15 +01:00
rodzic 31cfabc275
commit 70d263ce6e
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -122,9 +122,12 @@ function InlinePanel(opts) {
var self = {};
self.setHasContent = function(){
if($('li:visible', self.formsUl).length){
if($('> li', self.formsUl).not(".deleted").length){
console.log(self.formsUl)
console.log('here');
self.formsUl.parent().removeClass('empty');
}else{
console.log('there');
self.formsUl.parent().addClass('empty');
}
};
@ -139,7 +142,7 @@ function InlinePanel(opts) {
$('#' + deleteInputId + '-button').click(function() {
/* set 'deleted' form field to true */
$('#' + deleteInputId).val('1');
$('#' + childId).slideUp(function() {
$('#' + childId).addClass('deleted').slideUp(function() {
self.updateMoveButtonDisabledStates();
self.setHasContent();
});
@ -191,8 +194,8 @@ function InlinePanel(opts) {
/* 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() {
if ($('#' + deleteInputId).val() === "1" ) {
$('#' + childId).addClass('deleted').hide(0, function() {
self.updateMoveButtonDisabledStates();
self.setHasContent();
});