Skip to content

Commit c67c80d

Browse files
authored
Merge from docusealco/wip
2 parents 395d43d + 5442655 commit c67c80d

34 files changed

+296
-84
lines changed

app/controllers/pwa_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
class PwaController < ActionController::Base
4+
end

app/javascript/submission_form/areas.vue

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
:with-label="withLabel && !withFieldPlaceholder && step.length < 2"
3232
:is-value-set="step.some((f) => f.uuid in values)"
3333
:attachments-index="attachmentsIndex"
34-
@click="$emit('focus-step', stepIndex)"
34+
@click="[$emit('focus-step', stepIndex), maybeScrollOnClick(field, area)]"
3535
/>
3636
</Teleport>
3737
</template>
@@ -109,6 +109,14 @@ export default {
109109
areaRefs: []
110110
}
111111
},
112+
computed: {
113+
isMobileContainer () {
114+
const root = this.$root.$el.parentNode.getRootNode()
115+
const container = root.body || root.querySelector('div')
116+
117+
return container.style.overflow === 'hidden'
118+
}
119+
},
112120
beforeUpdate () {
113121
this.areaRefs = []
114122
},
@@ -121,14 +129,16 @@ export default {
121129
this.scrollIntoArea(field.areas[0])
122130
}
123131
},
132+
maybeScrollOnClick (field, area) {
133+
if (['text', 'number', 'cells'].includes(field.type) && this.isMobileContainer) {
134+
this.scrollIntoArea(area)
135+
}
136+
},
124137
scrollIntoArea (area) {
125138
const areaRef = this.areaRefs.find((a) => a.area === area)
126139
127140
if (areaRef) {
128-
const root = this.$root.$el.parentNode.getRootNode()
129-
const container = root.body || root.querySelector('div')
130-
131-
if (container.style.overflow === 'hidden') {
141+
if (this.isMobileContainer) {
132142
this.scrollInContainer(areaRef.$el)
133143
} else {
134144
const targetRect = areaRef.$refs.scrollToElem.getBoundingClientRect()

app/javascript/submission_form/attachment_step.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<MarkdownContent :string="field.description" />
5050
</div>
5151
<FileDropzone
52-
:message="`${t('upload')} ${field.name || t('files')}${field.required ? '' : ` (${t('optional')})`}`"
52+
:message="`${t('upload')} ${(field.title || field.name) || t('files')}${field.required ? '' : ` (${t('optional')})`}`"
5353
:submitter-slug="submitterSlug"
5454
:multiple="true"
5555
:dry-run="dryRun"

app/javascript/submission_form/date_step.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
<template>
22
<div dir="auto">
33
<div
4-
class="flex justify-between items-center w-full"
4+
class="flex justify-between items-end w-full mb-3.5 sm:mb-4"
55
:class="{ 'mb-2': !field.description }"
66
>
77
<label
8+
v-if="showFieldNames"
89
:for="field.uuid"
9-
class="label text-2xl"
10+
class="label text-xl sm:text-2xl py-0"
1011
>
1112
<MarkdownContent
1213
v-if="field.title"
1314
:string="field.title"
1415
/>
1516
<template v-else>
16-
{{ field.name && showFieldNames ? field.name : t('date') }}
17-
<template v-if="!field.required">
17+
{{ field.name || t('date') }}
18+
</template>
19+
<template v-if="!field.required">
20+
<span
21+
class="ml-1"
22+
:class="{ 'hidden sm:inline': (field.title || field.name || t('date') ).length > 10 }"
23+
>
1824
({{ t('optional') }})
19-
</template>
25+
</span>
2026
</template>
2127
</label>
2228
<button

app/javascript/submission_form/form.vue

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
v-if="showFieldNames && (currentField.name || currentField.title)"
165165
:for="currentField.uuid"
166166
dir="auto"
167-
class="label text-2xl"
167+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
168168
:class="{ 'mb-2': !currentField.description }"
169169
>
170170
<MarkdownContent
@@ -173,7 +173,11 @@
173173
/>
174174
<template v-else>
175175
{{ currentField.name }}
176-
<template v-if="!currentField.required">({{ t('optional') }})</template>
176+
</template>
177+
<template v-if="!currentField.required">
178+
<span :class="{ 'hidden sm:inline': (currentField.title || currentField.name).length > 20 }">
179+
({{ t('optional') }})
180+
</span>
177181
</template>
178182
</label>
179183
<div
@@ -221,7 +225,7 @@
221225
v-if="showFieldNames && (currentField.name || currentField.title)"
222226
:for="currentField.uuid"
223227
dir="auto"
224-
class="label text-2xl"
228+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
225229
:class="{ 'mb-2': !currentField.description }"
226230
>
227231
<MarkdownContent
@@ -230,7 +234,11 @@
230234
/>
231235
<template v-else>
232236
{{ currentField.name }}
233-
<template v-if="!currentField.required">({{ t('optional') }})</template>
237+
</template>
238+
<template v-if="!currentField.required">
239+
<span :class="{ 'hidden sm:inline': (currentField.title || currentField.name).length > 20 }">
240+
({{ t('optional') }})
241+
</span>
234242
</template>
235243
</label>
236244
<div
@@ -466,7 +474,7 @@
466474
</div>
467475
<div
468476
v-if="(currentField.type !== 'payment' && currentField.type !== 'verification') || submittedValues[currentField.uuid]"
469-
:class="currentField.type === 'signature' ? 'mt-2' : 'mt-6 md:mt-8'"
477+
:class="currentField.type === 'signature' ? 'mt-2' : 'mt-4 md:mt-6'"
470478
>
471479
<button
472480
id="submit_form_button"
@@ -522,9 +530,9 @@
522530
/>
523531
<div
524532
v-if="stepFields.length < 80"
525-
class="flex justify-center"
533+
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1"
526534
>
527-
<div class="flex items-center mt-4 mb-1 flex-wrap">
535+
<div class="flex items-center flex-wrap">
528536
<a
529537
v-for="(step, index) in stepFields"
530538
:key="step[0].uuid"

app/javascript/submission_form/image_step.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
<template>
22
<div v-if="modelValue">
3-
<div class="flex justify-between items-center w-full mb-2">
3+
<div class="flex justify-between items-end w-full mb-3.5 md:mb-4">
44
<label
5-
class="label text-2xl"
6-
>{{ showFieldNames && field.name ? field.name : t('image') }}</label>
5+
v-if="showFieldNames"
6+
:for="field.uuid"
7+
class="label text-xl sm:text-2xl py-0"
8+
>
9+
<MarkdownContent
10+
v-if="field.title"
11+
:string="field.title"
12+
/>
13+
<template v-else>
14+
{{ field.name || t('image') }}
15+
</template>
16+
</label>
717
<button
818
class="btn btn-outline btn-sm"
919
@click.prevent="remove"
@@ -35,7 +45,7 @@
3545
<MarkdownContent :string="field.description" />
3646
</div>
3747
<FileDropzone
38-
:message="`${t('upload')} ${field.name || t('image')}${field.required ? '' : ` (${t('optional')})`}`"
48+
:message="`${t('upload')} ${(field.title || field.name) || t('image')}${field.required ? '' : ` (${t('optional')})`}`"
3949
:submitter-slug="submitterSlug"
4050
:dry-run="dryRun"
4151
:accept="'image/*'"

app/javascript/submission_form/initials_step.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<template>
22
<div dir="auto">
33
<div
4-
class="flex justify-between items-center w-full"
4+
class="flex justify-between items-end w-full mb-3.5 md:mb-4"
55
:class="{ 'mb-2': !field.description }"
66
>
77
<label
8-
class="label text-2xl"
8+
v-if="showFieldNames"
9+
class="label text-xl sm:text-2xl py-0"
910
>
1011
<MarkdownContent
1112
v-if="field.title"
1213
:string="field.title"
1314
/>
1415
<template v-else>
15-
{{ showFieldNames && field.name ? field.name : t('initials') }}
16+
{{ field.name || t('initials') }}
1617
</template>
1718
</label>
18-
<div class="space-x-2 flex">
19+
<div class="space-x-2 flex flex-none">
1920
<span
2021
v-if="isDrawInitials"
2122
class="tooltip"

app/javascript/submission_form/invite_form.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
>
4141
</div>
4242
<div
43-
class="mt-6 md:mt-8"
43+
class="mt-4 md:mt-6"
4444
>
4545
<button
4646
type="submit"

app/javascript/submission_form/multi_select_step.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
v-if="showFieldNames && (field.name || field.title)"
44
:for="field.uuid"
55
dir="auto"
6-
class="label text-2xl"
6+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
77
:class="{ 'mb-2': !field.description }"
8-
><MarkdownContent
9-
v-if="field.title"
10-
:string="field.title"
11-
/>
8+
>
9+
<MarkdownContent
10+
v-if="field.title"
11+
:string="field.title"
12+
/>
1213
<template v-else>{{ field.name }}</template>
14+
<template v-if="!field.required">
15+
<span :class="{ 'hidden sm:inline': (field.title || field.name).length > 20 }">
16+
({{ t('optional') }})
17+
</span>
18+
</template>
1319
</label>
1420
<div
1521
v-if="field.description"

app/javascript/submission_form/number_step.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
v-if="showFieldNames && (field.name || field.title)"
44
:for="field.uuid"
55
dir="auto"
6-
class="label text-2xl"
6+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
77
:class="{ 'mb-2': !field.description }"
8-
><MarkdownContent
9-
v-if="field.title"
10-
:string="field.title"
11-
/>
8+
>
9+
<MarkdownContent
10+
v-if="field.title"
11+
:string="field.title"
12+
/>
1213
<template v-else>{{ field.name }}</template>
1314
<template v-if="!field.required">
14-
({{ t('optional') }})
15+
<span :class="{ 'hidden sm:inline': (field.title || field.name).length > 20 }">
16+
({{ t('optional') }})
17+
</span>
1518
</template>
1619
</label>
1720
<div

0 commit comments

Comments
 (0)