| | |
| | | } |
| | | |
| | | if (Object.hasOwn(this.ui.table.table.dataset, 'edit')) { |
| | | new window.jvbPopulate(row, item.fields, item.images); |
| | | new window.jvbPopulate(row, item); |
| | | } else { |
| | | for (let [key, value] of Object.entries(item)) { |
| | | let col = row.querySelector(`[data-field="${key}"]`); |
| | |
| | | let timelinePoint = row.querySelector('.timeline-point'); |
| | | let tbody = row; |
| | | |
| | | // Populate shared fields - NO prefixing! |
| | | // Populate shared fields |
| | | let sharedRow = row.querySelector('tr.shared'); |
| | | new window.jvbPopulate(sharedRow, item.fields, item.images); |
| | | new window.jvbPopulate(sharedRow, item); |
| | | this.prefixTimelineFieldNames(sharedRow, item.id); |
| | | this.cleanupTableRow(sharedRow); |
| | | |
| | | // Handle timeline points - NO prefixing! |
| | | // Handle timeline points |
| | | if (item.fields.timeline && typeof item.fields.timeline === 'object') { |
| | | const timelineArray = Object.entries(item.fields.timeline); |
| | | |
| | | timelineArray.forEach(([imgId, timeline], index) => { |
| | | |
| | | let point = timelinePoint.cloneNode(true); |
| | | point.dataset.index = index; |
| | | point.dataset.imageId = imgId; |
| | | |
| | | // NEW: Create item-like structure for timeline point |
| | | const timelineItem = { |
| | | fields: timeline, |
| | | images: item.images, |
| | | taxonomies: {} // Timeline points don't have taxonomies |
| | | }; |
| | | |
| | | new window.jvbPopulate(point, timeline, item.images); |
| | | new window.jvbPopulate(point, timelineItem); |
| | | |
| | | this.cleanupTableRow(point); |
| | | let imgdata = item.images[timeline.post_thumbnail]; |
| | |
| | | point.querySelector('.field.upload').title = imgdata['image-title']; |
| | | } |
| | | |
| | | this.prefixTimelineFieldNames(point,timeline.id); |
| | | this.prefixTimelineFieldNames(point, timeline.id); |
| | | |
| | | tbody.insertBefore(point, timelinePoint); |
| | | }); |