diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index 59dbb551..2fe9900f 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -383,10 +383,7 @@ export default { await stepPromise() - return fetch(this.submitPath, { - method: 'POST', - body: new FormData(this.$refs.form) - }).then(response => { + this.saveStep().then(response => { const nextStep = this.stepFields[this.currentStep + 1] if (nextStep) { diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 460f2537..c85e2e22 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -21,11 +21,12 @@
- <% @submission.template.documents.each do |document| %> + <% @submission.template.schema.each do |item| %> + <% document = @submission.template.documents.find { |a| item['attachment_uuid'] == a.uuid } %> " onclick="[event.preventDefault(), window[event.target.closest('a').href.split('#')[1]].scrollIntoView({ behavior: 'smooth', block: 'start' })]" class="block cursor-pointer">
- <%= @submission.template.schema.find { |e| e['attachment_uuid'] == document.uuid }&.dig('name').presence || attachment.filename.base %> + <%= item['name'].presence || document.filename.base %>
<% end %> diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index 8e27df20..80b597bc 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -49,7 +49,7 @@ module Submissions attachment.download else Vips::Image.new_from_buffer(attachment.download, '') - .write_to_buffer('.jpg', Q: 40) + .write_to_buffer('.png') end io = StringIO.new(image_data) diff --git a/lib/templates/process_document.rb b/lib/templates/process_document.rb index 7d9764a8..b7649cce 100644 --- a/lib/templates/process_document.rb +++ b/lib/templates/process_document.rb @@ -15,7 +15,7 @@ module Templates def call(attachment) if attachment.content_type == PDF_CONTENT_TYPE generate_pdf_preview_images(attachment) - elsif attachment.content_type.starts_with?('image/') + elsif attachment.image? generate_preview_image(attachment) end