fix submission result

pull/105/head
Alex Turchyn 2 years ago
parent 8a6430f117
commit 43b32d05cb

@ -383,10 +383,7 @@ export default {
await stepPromise() await stepPromise()
return fetch(this.submitPath, { this.saveStep().then(response => {
method: 'POST',
body: new FormData(this.$refs.form)
}).then(response => {
const nextStep = this.stepFields[this.currentStep + 1] const nextStep = this.stepFields[this.currentStep + 1]
if (nextStep) { if (nextStep) {

@ -21,11 +21,12 @@
</div> </div>
<div class="flex" style="max-height: calc(100vh - 60px)"> <div class="flex" style="max-height: calc(100vh - 60px)">
<div class="overflow-y-auto overflow-x-hidden w-52 flex-none pr-3 mt-0.5 pt-0.5"> <div class="overflow-y-auto overflow-x-hidden w-52 flex-none pr-3 mt-0.5 pt-0.5">
<% @submission.template.documents.each do |document| %> <% @submission.template.schema.each do |item| %>
<% document = @submission.template.documents.find { |a| item['attachment_uuid'] == a.uuid } %>
<a href="#<%= "page-#{document.uuid}-0" %>" onclick="[event.preventDefault(), window[event.target.closest('a').href.split('#')[1]].scrollIntoView({ behavior: 'smooth', block: 'start' })]" class="block cursor-pointer"> <a href="#<%= "page-#{document.uuid}-0" %>" onclick="[event.preventDefault(), window[event.target.closest('a').href.split('#')[1]].scrollIntoView({ behavior: 'smooth', block: 'start' })]" class="block cursor-pointer">
<img src="<%= document.preview_images.first.url %>" width="<%= document.preview_images.first.metadata['width'] %>" height="<%= document.preview_images.first.metadata['height'] %>" class="rounded border" loading="lazy" > <img src="<%= document.preview_images.first.url %>" width="<%= document.preview_images.first.metadata['width'] %>" height="<%= document.preview_images.first.metadata['height'] %>" class="rounded border" loading="lazy" >
<div class="pb-2 pt-1.5 text-center"> <div class="pb-2 pt-1.5 text-center">
<%= @submission.template.schema.find { |e| e['attachment_uuid'] == document.uuid }&.dig('name').presence || attachment.filename.base %> <%= item['name'].presence || document.filename.base %>
</div> </div>
</a> </a>
<% end %> <% end %>

@ -49,7 +49,7 @@ module Submissions
attachment.download attachment.download
else else
Vips::Image.new_from_buffer(attachment.download, '') Vips::Image.new_from_buffer(attachment.download, '')
.write_to_buffer('.jpg', Q: 40) .write_to_buffer('.png')
end end
io = StringIO.new(image_data) io = StringIO.new(image_data)

@ -15,7 +15,7 @@ module Templates
def call(attachment) def call(attachment)
if attachment.content_type == PDF_CONTENT_TYPE if attachment.content_type == PDF_CONTENT_TYPE
generate_pdf_preview_images(attachment) generate_pdf_preview_images(attachment)
elsif attachment.content_type.starts_with?('image/') elsif attachment.image?
generate_preview_image(attachment) generate_preview_image(attachment)
end end

Loading…
Cancel
Save