diff --git a/app/controllers/api/attachments_controller.rb b/app/controllers/api/attachments_controller.rb index 6f82da4e..e93dc53c 100644 --- a/app/controllers/api/attachments_controller.rb +++ b/app/controllers/api/attachments_controller.rb @@ -7,7 +7,7 @@ module Api def create record = if params[:template_slug].present? - Template.find_by(slug: params[:template_slug]) + Template.find_by!(slug: params[:template_slug]) else Submitter.find_by!(slug: params[:submitter_slug]) end diff --git a/app/controllers/api/templates_documents_controller.rb b/app/controllers/api/templates_documents_controller.rb index 196eeaaf..16dbf20a 100644 --- a/app/controllers/api/templates_documents_controller.rb +++ b/app/controllers/api/templates_documents_controller.rb @@ -26,7 +26,7 @@ module Api def del_image template = Template.find(params[:template_id]) - document = template.documents.find(params[:documentId]) + document = template.documents.find(params[:document_id]) img_attachment_id = params[:attachment_id] page_number = document.preview_images.find_index { |pic| pic.id == img_attachment_id } if page_number diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index ca4d91c7..21222993 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -733,7 +733,7 @@ export default { stepPromise().then(async () => { const emptyRequiredField = this.stepFields.find((fields, index) => { - if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date', 'my_check'].includes(fields[0].type)) { + if (['redact', 'my_text', 'my_signature', 'my_initials', 'my_date', 'my_check'].includes(fields[0]?.type)) { fields[0].required = 'false' return false } else { diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 7d85ef78..41a35d15 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -564,7 +564,7 @@ export default { } }, scrollIntoDocument (item, page) { - const documentRef = this.documentRefs.find((e) => e.document.uuid === item.attachment_uuid) + const documentRef = this.documentRefs.find((e) => e.document?.uuid === item.attachment_uuid) documentRef.scrollIntoDocument(page) }, onKeyUp (e) { @@ -942,7 +942,7 @@ export default { body: JSON.stringify({ template: this.template.id, attachment_id: imageId, - documentId + document_id: documentId }) }) .then((response) => { diff --git a/app/javascript/template_builder/document.vue b/app/javascript/template_builder/document.vue index bc9fdcd7..b189f985 100644 --- a/app/javascript/template_builder/document.vue +++ b/app/javascript/template_builder/document.vue @@ -111,7 +111,7 @@ export default { this.pageRefs[area.page].areaRefs.find((e) => e.area === area).$el.scrollIntoView({ behavior: 'smooth', block: 'center' }) }, scrollIntoDocument (page) { - const ref = this.pageRefs.find((e) => e.image.uuid === page.uuid) + const ref = this.pageRefs.find((e) => e.image?.uuid === page.uuid) ref.$el.scrollIntoView({ behavior: 'smooth', block: 'start' }) }, setPageRefs (el) { diff --git a/app/javascript/template_builder/field_submitter.vue b/app/javascript/template_builder/field_submitter.vue index e743065c..3611cf47 100644 --- a/app/javascript/template_builder/field_submitter.vue +++ b/app/javascript/template_builder/field_submitter.vue @@ -57,7 +57,7 @@ -