diff --git a/app/javascript/submission_form/areas.vue b/app/javascript/submission_form/areas.vue index 3d7fa340..d0cdb527 100644 --- a/app/javascript/submission_form/areas.vue +++ b/app/javascript/submission_form/areas.vue @@ -73,7 +73,11 @@ export default { scrollIntoField (field) { this.areaRefs.find((area) => { if (area.field === field) { - area.$refs.scrollToElem.scrollIntoView({ behavior: 'smooth', block: 'start' }) + if (document.body.style.overflow === 'hidden') { + this.scrollInContainer(area.$el) + } else { + area.$refs.scrollToElem.scrollIntoView({ behavior: 'smooth', block: 'start' }) + } return true } else { @@ -81,6 +85,15 @@ export default { } }) }, + scrollInContainer (target) { + const padding = 64 + const boxRect = window.scrollbox.children[0].getBoundingClientRect() + const targetRect = target.getBoundingClientRect() + + const targetTopRelativeToBox = targetRect.top - boxRect.top + + window.scrollbox.scrollTop = targetTopRelativeToBox - document.body.offsetHeight + window.form_container.offsetHeight + target.offsetHeight + padding + }, setAreaRef (el) { if (el) { this.areaRefs.push(el) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index 5674a739..93f6f8c3 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -369,6 +369,13 @@ export default { this.stepFields.indexOf([...this.stepFields].reverse().find((fields) => fields.some((f) => !!this.values[f.uuid]))) + 1, this.stepFields.length - 1 ) + + if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { + document.body.style.overflow = 'hidden' + + window.scrollbox.classList.add('h-full', 'overflow-y-auto') + window.scrollbox.parentNode.classList.add('h-screen', 'overflow-y-auto') + } }, methods: { goToStep (step, scrollToArea = false, clickUpload = false) { diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 61abcc5e..6e40a5d6 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -5,7 +5,7 @@ <%= @submission.template.name %>
- <% if last_submitter = @submission.submitters.select(&:completed_at?).max_by(&:completed_at) %> + <% if last_submitter = @submission.submitters.to_a.select(&:completed_at?).max_by(&:completed_at) %> <%= svg_icon('download', class: 'w-6 h-6') %> @@ -16,6 +16,8 @@ Downloading + <% elsif @submission.submitters.to_a.size == 1 %> + <%= render 'shared/clipboard_copy', text: start_form_url(slug: @submission.template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Share Link', copied_title: 'Copied to Clipboard' %> <% end %>
diff --git a/app/views/submit_form/show.html.erb b/app/views/submit_form/show.html.erb index e093761a..1cbbec9f 100644 --- a/app/views/submit_form/show.html.erb +++ b/app/views/submit_form/show.html.erb @@ -1,34 +1,38 @@ <% fields_index = Templates.build_field_areas_index(@submitter.submission.template) %> <% values = @submitter.submission.submitters.where.not(id: @submitter.id).reduce({}) { |acc, sub| acc.merge(sub.values) } %> <% attachments_index = ActiveStorage::Attachment.where(record: @submitter.submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %> -
-
- - <%= render 'shared/logo', class: 'w-9 h-9 md:w-12 md:h-12' %> - DocuSeal - -
- <% @submitter.submission.template.schema.each do |item| %> - <% document = @submitter.submission.template.documents.find { |a| a.uuid == item['attachment_uuid'] } %> - <% document.preview_images.sort_by { |a| a.filename.base.to_i }.each_with_index do |page, index| %> -
- -
- <% fields_index.dig(document.uuid, index)&.each do |(area, field)| %> - <% value = values[field['uuid']] %> - <% next if value.blank? %> - <%= render 'submissions/value', area:, field:, attachments_index:, value:, locale: @submitter.submission.template.account.locale %> - <% end %> -
+
+
+
+ - <% end %> - <% end %> - <%= render 'shared/attribution' %> + <% @submitter.submission.template.schema.each do |item| %> + <% document = @submitter.submission.template.documents.find { |a| a.uuid == item['attachment_uuid'] } %> + <% document.preview_images.sort_by { |a| a.filename.base.to_i }.each_with_index do |page, index| %> +
+ +
+ <% fields_index.dig(document.uuid, index)&.each do |(area, field)| %> + <% value = values[field['uuid']] %> + <% next if value.blank? %> + <%= render 'submissions/value', area:, field:, attachments_index:, value:, locale: @submitter.submission.template.account.locale %> + <% end %> +
+
+ <% end %> + <% end %> + <%= render 'shared/attribution' %> +
+