fix submission result

This commit is contained in:
Alex Turchyn
2023-06-25 11:35:23 +03:00
parent 8a6430f117
commit 43b32d05cb
4 changed files with 6 additions and 8 deletions
+1 -4
View File
@@ -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) {
+3 -2
View File
@@ -21,11 +21,12 @@
</div>
<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">
<% @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">
<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">
<%= @submission.template.schema.find { |e| e['attachment_uuid'] == document.uuid }&.dig('name').presence || attachment.filename.base %>
<%= item['name'].presence || document.filename.base %>
</div>
</a>
<% end %>
@@ -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)
+1 -1
View File
@@ -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