Skip to content

Commit ef05f03

Browse files
authored
Merge from docusealco/wip
2 parents 5764b4d + b8c36ff commit ef05f03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+467
-217
lines changed

Gemfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,18 +338,18 @@ GEM
338338
net-smtp (0.5.0)
339339
net-protocol
340340
nio4r (2.7.4)
341-
nokogiri (1.18.3)
341+
nokogiri (1.18.5)
342342
mini_portile2 (~> 2.8.2)
343343
racc (~> 1.4)
344-
nokogiri (1.18.3-aarch64-linux-gnu)
344+
nokogiri (1.18.5-aarch64-linux-gnu)
345345
racc (~> 1.4)
346-
nokogiri (1.18.3-aarch64-linux-musl)
346+
nokogiri (1.18.5-aarch64-linux-musl)
347347
racc (~> 1.4)
348-
nokogiri (1.18.3-arm64-darwin)
348+
nokogiri (1.18.5-arm64-darwin)
349349
racc (~> 1.4)
350-
nokogiri (1.18.3-x86_64-linux-gnu)
350+
nokogiri (1.18.5-x86_64-linux-gnu)
351351
racc (~> 1.4)
352-
nokogiri (1.18.3-x86_64-linux-musl)
352+
nokogiri (1.18.5-x86_64-linux-musl)
353353
racc (~> 1.4)
354354
oj (3.16.8)
355355
bigdecimal (>= 3.0)
@@ -387,7 +387,7 @@ GEM
387387
puma (6.5.0)
388388
nio4r (~> 2.0)
389389
racc (1.8.1)
390-
rack (3.1.10)
390+
rack (3.1.12)
391391
rack-proxy (0.7.7)
392392
rack
393393
rack-session (2.0.0)

app/controllers/api/submissions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def submissions_params
179179
message: %i[subject body],
180180
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
181181
:completed, :phone, :application_key, :external_id, :reply_to, :go_to_last,
182-
{ metadata: {}, values: {}, readonly_fields: [], message: %i[subject body],
182+
{ metadata: {}, values: {}, roles: [], readonly_fields: [], message: %i[subject body],
183183
fields: [:name, :uuid, :default_value, :value, :title, :description,
184184
:readonly, :validation_pattern, :invalid_message,
185185
{ default_value: [], value: [], preferences: {} }] }]]

app/controllers/start_form_controller.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def update
2525
redirect_to start_form_completed_path(@template.slug, email: submitter_params[:email])
2626
else
2727
if filter_undefined_submitters(@template).size > 1 && @submitter.new_record?
28-
@error_message = I18n.t('not_found')
28+
@error_message = multiple_submitters_error_message
2929

3030
return render :show
3131
end
@@ -117,4 +117,12 @@ def load_template
117117

118118
@template = Template.find_by!(slug:)
119119
end
120+
121+
def multiple_submitters_error_message
122+
if current_user&.account_id == @template.account_id
123+
helpers.t('this_submission_has_multiple_signers_which_prevents_the_use_of_a_sharing_link_html')
124+
else
125+
I18n.t('not_found')
126+
end
127+
end
120128
end

app/controllers/templates_debug_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ class TemplatesDebugController < ApplicationController
66
def show
77
attachment = @template.documents.first
88

9-
pdf = HexaPDF::Document.new(io: StringIO.new(attachment.download))
9+
data = attachment.download
10+
pdf = HexaPDF::Document.new(io: StringIO.new(data))
1011

11-
fields = Templates::FindAcroFields.call(pdf, attachment)
12+
fields = Templates::FindAcroFields.call(pdf, attachment, data)
1213

1314
attachment.metadata['pdf'] ||= {}
1415
attachment.metadata['pdf']['fields'] = fields

app/javascript/submission_form/area.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<div
3-
class="field-area flex absolute lg:text-base -outline-offset-1"
3+
class="flex absolute lg:text-base -outline-offset-1 field-area"
44
dir="auto"
55
:style="computedStyle"
6-
:class="{ 'text-[1.6vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'field-area-active outline-red-500 outline-dashed outline-2 z-10': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }"
6+
:class="{ 'text-[1.6vw] lg:text-base': !textOverflowChars, 'text-[1.0vw] lg:text-xs': textOverflowChars, 'cursor-default': !submittable, 'border border-red-100 bg-red-100 cursor-pointer': submittable, 'border border-red-100': !isActive && submittable, 'bg-opacity-80': !isActive && !isValueSet && submittable, 'outline-red-500 outline-dashed outline-2 z-10 field-area-active': isActive && submittable, 'bg-opacity-40': (isActive || isValueSet) && submittable }"
77
>
88
<div
99
v-if="(!withFieldPlaceholder || !field.name || field.type === 'cells') && !isActive && !isValueSet && field.type !== 'checkbox' && submittable && !area.option_uuid"

app/javascript/submission_form/attachment_step.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
>
1414
<a
1515
v-if="val"
16-
class="flex items-center space-x-1.5 w-full"
16+
class="flex items-center space-x-1.5 w-full attachment-file-name"
1717
:href="attachmentsIndex[val].url"
1818
target="_blank"
1919
>
@@ -26,7 +26,10 @@
2626
{{ attachmentsIndex[val].filename }}
2727
</span>
2828
</a>
29-
<button @click.prevent="removeAttachment(val)">
29+
<button
30+
class="remove-attachment-button"
31+
@click.prevent="removeAttachment(val)"
32+
>
3033
<IconTrashX
3134
:width="18"
3235
:heigh="19"
@@ -44,7 +47,7 @@
4447
<div
4548
v-if="field.description && !modelValue.length"
4649
dir="auto"
47-
class="mb-3 px-1"
50+
class="mb-3 px-1 field-description-text"
4851
>
4952
<MarkdownContent :string="field.description" />
5053
</div>

app/javascript/submission_form/completed.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div
33
id="form_completed"
4-
class="mx-auto max-w-md flex flex-col"
4+
class="mx-auto max-w-md flex flex-col completed-form"
55
dir="auto"
66
>
77
<div class="font-medium text-2xl flex items-center space-x-1.5 mx-auto">
@@ -10,13 +10,13 @@
1010
:width="30"
1111
:height="30"
1212
/>
13-
<span>
13+
<span class="completed-form-message-title">
1414
{{ completedMessage.title || (hasSignatureFields ? (hasMultipleDocuments ? t('documents_have_been_signed') : t('document_has_been_signed')) : t('form_has_been_completed')) }}
1515
</span>
1616
</div>
1717
<div
1818
v-if="completedMessage.body"
19-
class="mt-2"
19+
class="mt-2 completed-form-message-body"
2020
>
2121
<MarkdownContent
2222
:string="completedMessage.body"
@@ -27,15 +27,15 @@
2727
v-if="completedButton.url"
2828
:href="sanitizeHref(completedButton.url)"
2929
rel="noopener noreferrer nofollow"
30-
class="white-button flex items-center w-full"
30+
class="white-button flex items-center w-full completed-form-completed-button"
3131
>
3232
<span>
3333
{{ completedButton.title || 'Back to Website' }}
3434
</span>
3535
</a>
3636
<button
3737
v-if="canSendEmail && !isDemo && withSendCopyButton"
38-
class="white-button !h-auto flex items-center space-x-1 w-full"
38+
class="white-button !h-auto flex items-center space-x-1 w-full completed-form-send-copy-button"
3939
:disabled="isSendingCopy"
4040
@click.prevent="sendCopyToEmail"
4141
>
@@ -50,7 +50,7 @@
5050
</button>
5151
<button
5252
v-if="!isWebView && withDownloadButton"
53-
class="base-button flex items-center space-x-1 w-full"
53+
class="base-button flex items-center space-x-1 w-full completed-form-download-button"
5454
:disabled="isDownloading"
5555
@click.prevent="download"
5656
>

app/javascript/submission_form/date_step.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<label
88
v-if="showFieldNames"
99
:for="field.uuid"
10-
class="label text-xl sm:text-2xl py-0"
10+
class="label text-xl sm:text-2xl py-0 field-name-label"
1111
>
1212
<MarkdownContent
1313
v-if="field.title"
@@ -26,7 +26,7 @@
2626
</template>
2727
</label>
2828
<button
29-
class="btn btn-outline btn-sm !normal-case font-normal"
29+
class="btn btn-outline btn-sm !normal-case font-normal set-current-date-button"
3030
@click.prevent="[setCurrentDate(), $emit('focus')]"
3131
>
3232
<IconCalendarCheck :width="16" />
@@ -35,7 +35,7 @@
3535
</div>
3636
<div
3737
v-if="field.description"
38-
class="mb-3 px-1"
38+
class="mb-3 px-1 field-description-text"
3939
dir="auto"
4040
>
4141
<MarkdownContent :string="field.description" />

app/javascript/submission_form/dropzone.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
>
88
<label
99
:for="inputId"
10-
class="w-full relative bg-base-300 hover:bg-base-200 rounded-md border border-base-content border-dashed"
10+
class="w-full relative bg-base-300 hover:bg-base-200 rounded-md border border-base-content border-dashed file-dropzone"
1111
:class="{ 'opacity-50': isLoading }"
1212
>
1313
<div class="absolute top-0 right-0 left-0 bottom-0 flex items-center justify-center">

app/javascript/submission_form/form.vue

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<button
6868
v-if="!isFormVisible"
6969
id="expand_form_button"
70-
class="btn btn-neutral flex text-white absolute bottom-0 w-full mb-3"
70+
class="btn btn-neutral flex text-white absolute bottom-0 w-full mb-3 expand-form-button"
7171
style="width: 96%; margin-left: 2%"
7272
@click.prevent="[isFormVisible = true, scrollIntoField(currentField)]"
7373
>
@@ -93,14 +93,14 @@
9393
<div
9494
v-show="isFormVisible"
9595
id="form_container"
96-
class="shadow-md bg-base-100 absolute bottom-0 w-full border-base-200 border p-4 rounded"
96+
class="shadow-md bg-base-100 absolute bottom-0 w-full border-base-200 border p-4 rounded form-container"
9797
:class="{ 'md:bottom-4': isBreakpointMd }"
9898
:style="{ backgroundColor: backgroundColor }"
9999
>
100100
<button
101101
v-if="!isCompleted"
102102
id="minimize_form_button"
103-
class="absolute right-0 top-0"
103+
class="absolute right-0 top-0 minimize-form-button"
104104
:class="currentField?.description?.length > 100 ? 'mr-1 mt-1 md:mr-2 md:mt-2': 'mr-2 mt-2 hidden md:block'"
105105
:title="t('minimize')"
106106
@click.prevent="minimizeForm"
@@ -119,7 +119,7 @@
119119
ref="form"
120120
:action="submitPath"
121121
method="post"
122-
class="mx-auto"
122+
class="mx-auto steps-form"
123123
:style="{ maxWidth: isBreakpointMd ? '582px' : '' }"
124124
@submit.prevent="submitStep"
125125
>
@@ -165,7 +165,7 @@
165165
v-if="showFieldNames && (currentField.name || currentField.title)"
166166
:for="currentField.uuid"
167167
dir="auto"
168-
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
168+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5 field-name-label"
169169
:class="{ 'mb-2': !currentField.description }"
170170
>
171171
<MarkdownContent
@@ -188,7 +188,7 @@
188188
<div
189189
v-if="currentField.description"
190190
dir="auto"
191-
class="mb-3 px-1"
191+
class="mb-3 px-1 field-description-text"
192192
>
193193
<MarkdownContent :string="currentField.description" />
194194
</div>
@@ -226,7 +226,7 @@
226226
v-if="showFieldNames && (currentField.name || currentField.title)"
227227
:for="currentField.uuid"
228228
dir="auto"
229-
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5"
229+
class="label text-xl sm:text-2xl py-0 mb-2 sm:mb-3.5 field-name-label"
230230
:class="{ 'mb-2': !currentField.description }"
231231
>
232232
<MarkdownContent
@@ -245,7 +245,7 @@
245245
<div
246246
v-if="currentField.description"
247247
dir="auto"
248-
class="mb-3 px-1"
248+
class="mb-3 px-1 field-description-text"
249249
>
250250
<MarkdownContent :string="currentField.description" />
251251
</div>
@@ -270,7 +270,7 @@
270270
>
271271
<label
272272
:for="option.uuid"
273-
class="flex items-center space-x-3"
273+
class="flex items-center space-x-3 radio-label"
274274
>
275275
<input
276276
:id="option.uuid"
@@ -304,7 +304,7 @@
304304
<div
305305
v-if="currentField.description"
306306
dir="auto"
307-
class="mb-3 px-1"
307+
class="mb-3 px-1 field-description-text"
308308
>
309309
<MarkdownContent :string="currentField.description" />
310310
</div>
@@ -338,7 +338,7 @@
338338
>
339339
<label
340340
:for="field.uuid"
341-
class="flex items-center space-x-3"
341+
class="flex items-center space-x-3 checkbox-label"
342342
>
343343
<input
344344
type="hidden"
@@ -481,7 +481,7 @@
481481
id="submit_form_button"
482482
ref="submitButton"
483483
type="submit"
484-
class="base-button w-full flex justify-center"
484+
class="base-button w-full flex justify-center submit-form-button"
485485
:disabled="isButtonDisabled"
486486
>
487487
<span class="flex">
@@ -533,13 +533,13 @@
533533
v-if="stepFields.length < 80"
534534
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1"
535535
>
536-
<div class="flex items-center flex-wrap">
536+
<div class="flex items-center flex-wrap steps-progress">
537537
<a
538538
v-for="(step, index) in stepFields"
539539
:key="step[0].uuid"
540540
href="#"
541541
class="inline border border-base-300 h-3 w-3 rounded-full mx-1 mt-1"
542-
:class="{ 'bg-base-300': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }"
542+
:class="{ 'bg-base-300 steps-progress-current': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }"
543543
@click.prevent="isCompleted ? '' : [saveStep(), goToStep(index, true)]"
544544
/>
545545
</div>
@@ -1191,22 +1191,24 @@ export default {
11911191
return false
11921192
}
11931193

1194+
const defaultValue = !field || isEmpty(field.default_value) ? null : field.default_value
1195+
11941196
if (['empty', 'unchecked'].includes(condition.action)) {
1195-
return isEmpty(this.values[condition.field_uuid])
1197+
return isEmpty(this.values[condition.field_uuid] ?? defaultValue)
11961198
} else if (['not_empty', 'checked'].includes(condition.action)) {
1197-
return !isEmpty(this.values[condition.field_uuid])
1199+
return !isEmpty(this.values[condition.field_uuid] ?? defaultValue)
11981200
} else if (['equal', 'contains'].includes(condition.action) && field) {
11991201
if (field.options) {
12001202
const option = field.options.find((o) => o.uuid === condition.value)
1201-
const values = [this.values[condition.field_uuid]].flat()
1203+
const values = [this.values[condition.field_uuid] ?? defaultValue].flat()
12021204

12031205
return values.includes(this.optionValue(option, field.options.indexOf(option)))
12041206
} else {
1205-
return [this.values[condition.field_uuid]].flat().includes(condition.value)
1207+
return [this.values[condition.field_uuid] ?? defaultValue].flat().includes(condition.value)
12061208
}
12071209
} else if (['not_equal', 'does_not_contain'].includes(condition.action) && field) {
12081210
const option = field.options.find((o) => o.uuid === condition.value)
1209-
const values = [this.values[condition.field_uuid]].flat()
1211+
const values = [this.values[condition.field_uuid] ?? defaultValue].flat()
12101212

12111213
return !values.includes(this.optionValue(option, field.options.indexOf(option)))
12121214
} else {
@@ -1299,7 +1301,9 @@ export default {
12991301

13001302
if (!this.isCompleted) {
13011303
if (scrollToArea) {
1302-
this.scrollIntoField(this.currentField)
1304+
this.$nextTick(() => {
1305+
setTimeout(() => this.scrollIntoField(this.currentField), 1)
1306+
})
13031307
}
13041308

13051309
this.enableScrollIntoField = false
@@ -1316,7 +1320,7 @@ export default {
13161320
const currentFieldUuids = this.currentStepFields.map((f) => f.uuid)
13171321
const currentFieldType = this.currentField.type
13181322

1319-
if (!formData && !this.$refs.form.checkValidity()) {
1323+
if (!formData && !this.$refs.form.checkValidity() && currentFieldUuids.every((fieldUuid) => isEmpty(this.submittedValues[fieldUuid]) || !isEmpty(this.values[fieldUuid]))) {
13201324
return
13211325
}
13221326

0 commit comments

Comments
 (0)