Skip to content

Commit dc19434

Browse files
authored
fix: tabular inlines total forms (#1097)
1 parent 3f50191 commit dc19434

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/unfold/static/admin/js/inlines.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,24 @@
225225
}
226226
};
227227

228-
$this.each(function (i) {
229-
$(this)
230-
.not("." + options.emptyCssClass)
231-
.addClass(options.formCssClass);
232-
});
228+
// !CHANGED from original. Business logic for tabular inlines is different.
229+
if ($this.parent().is("tbody")) {
230+
$this
231+
.parent()
232+
.parent()
233+
.find("tr.form-row")
234+
.each(function (i) {
235+
$(this)
236+
.not("." + options.emptyCssClass)
237+
.addClass(options.formCssClass);
238+
});
239+
} else {
240+
$this.each(function (i) {
241+
$(this)
242+
.not("." + options.emptyCssClass)
243+
.addClass(options.formCssClass);
244+
});
245+
}
233246

234247
// Create the delete buttons for all unsaved inlines:
235248
$this

0 commit comments

Comments
 (0)