app/javascript/controllers/casa_nested_form_controller.js
Function addAndCreate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addAndCreate (e) {
this.add(e)
const items = this.element.querySelectorAll(this.wrapperSelectorValue)
const addedItem = items[items.length - 1]
// childIndex will be 0,1,... for items at page load, timestamps for items added to form.
Function destroyAndRemove
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
destroyAndRemove (e) {
const wrapper = e.target.closest(this.wrapperSelectorValue)
const recordId = this.getRecordId(wrapper)
if (wrapper.dataset.newRecord === 'false' && (recordId.length > 0)) {
fetch(`${this.routeValue}/${recordId}`, {