|
|
|
|
@ -3146,7 +3146,11 @@ export default {
|
|
|
|
|
|
|
|
|
|
const dynamicDocumentSaves = dynamicDocumentRefs.map((ref) => ref.saveBody())
|
|
|
|
|
|
|
|
|
|
Promise.all([this.save({ force: true, revision: this.withRevisions }), ...dynamicDocumentSaves]).then(() => {
|
|
|
|
|
Promise.all([this.save({ force: true }), ...dynamicDocumentSaves]).then(() => {
|
|
|
|
|
if (this.withRevisions) {
|
|
|
|
|
this.captureRevision()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.Turbo.visit(`/templates/${this.template.id}`)
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
this.isSaving = false
|
|
|
|
|
@ -3377,7 +3381,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
save ({ force = false, revision = false } = {}) {
|
|
|
|
|
save ({ force = false } = {}) {
|
|
|
|
|
this.pendingFieldAttachmentUuids = []
|
|
|
|
|
|
|
|
|
|
if (this.beforeRevisionSnapshot) {
|
|
|
|
|
@ -3409,8 +3413,7 @@ export default {
|
|
|
|
|
submitters: this.template.submitters,
|
|
|
|
|
fields: this.template.fields,
|
|
|
|
|
variables_schema: this.template.variables_schema
|
|
|
|
|
},
|
|
|
|
|
...(revision ? { revision: true } : {})
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
headers: { 'Content-Type': 'application/json' }
|
|
|
|
|
}).then(() => {
|
|
|
|
|
@ -3419,6 +3422,12 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
captureRevision () {
|
|
|
|
|
return this.baseFetch(`/templates/${this.template.id}/versions`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'Content-Type': 'application/json' }
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onDynamicDocumentUpdate () {
|
|
|
|
|
this.rebuildVariablesSchema()
|
|
|
|
|
|
|
|
|
|
|