Skip to content

Commit

Permalink
[req-changes] Fixed JS issues on validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Feb 13, 2024
1 parent 5152dc7 commit 36edf95
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions openwisp_controller/config/static/sortedm2m/patch_sortedm2m.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
'use strict';
(function ($) {
$(document).ready( function () {
if ($(".sortedm2m-items").length < 2) {
$('.sortedm2m-items').sortable('destroy');
$(document).ready(function () {
if ($('.sortedm2m-items').length < 2) {
destroyHiddenSortableWidget($);
}
$(document).on('click', 'a.inline-deletelink', function () {
destroyHiddenSortableWidget($);
});
});

function destroyHiddenSortableWidget($) {
$('.inline-related.empty-form .sortedm2m-items').sortable('destroy');
}

}(django.jQuery));

0 comments on commit 36edf95

Please sign in to comment.