orleans: highlight widgets with errors (#50565)

This commit is contained in:
Serghei Mihai 2021-01-26 15:55:47 +01:00
parent f3f4ebdc20
commit e8512b94a8
2 changed files with 24 additions and 0 deletions

View File

@ -288,3 +288,18 @@ div.buttons {
}
}
}
.widget {
.content {
display: inline-block;
max-width: 100%;
padding: .33em 0;
transition: background 0.3s linear;
&.with-padding {
padding: .33em;
}
}
&.widget-with-error .content {
background-color: $notification_error_color;
}
}

View File

@ -2,4 +2,13 @@ $(function() {
$('div.wcsformsofcategorycell').delegate('h2', 'click', function() {
$(this).parents('div.wcsformsofcategorycell').toggleClass('toggled');
});
/* reset error class when contents is changed */
var $widgets_with_error = $('.widget-with-error');
if ($widgets_with_error.length) {
$widgets_with_error
.find('.content').addClass('with-padding')
.on('change', 'input, select, textarea', function() {
$(this).parents('.widget-with-error').removeClass('widget-with-error');
})
}
});