From 0cc53066ebdff651eac93cb01a3dac8f1528d2d2 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Sun, 3 Sep 2023 20:44:54 +0300 Subject: [PATCH] refactor --- app/javascript/form.js | 1 + app/javascript/submission_form/completed.vue | 10 +++++++++- app/javascript/submission_form/form.vue | 6 ++++++ app/views/shared/_attribution.html.erb | 5 +---- app/views/shared/_powered_by.html.erb | 4 ++++ app/views/submit_form/_submission_form.html.erb | 3 +++ app/views/submit_form/show.html.erb | 2 +- 7 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 app/views/shared/_powered_by.html.erb create mode 100644 app/views/submit_form/_submission_form.html.erb diff --git a/app/javascript/form.js b/app/javascript/form.js index da33cdbe..df1eff3d 100644 --- a/app/javascript/form.js +++ b/app/javascript/form.js @@ -14,6 +14,7 @@ window.customElements.define('submission-form', class extends HTMLElement { canSendEmail: this.dataset.canSendEmail === 'true', isDirectUpload: this.dataset.isDirectUpload === 'true', isDemo: this.dataset.isDemo === 'true', + attribution: this.dataset.attribution !== 'false', withConfetti: true, values: reactive(JSON.parse(this.dataset.values)), attachments: reactive(JSON.parse(this.dataset.attachments)), diff --git a/app/javascript/submission_form/completed.vue b/app/javascript/submission_form/completed.vue index 2abae5ad..9108c945 100644 --- a/app/javascript/submission_form/completed.vue +++ b/app/javascript/submission_form/completed.vue @@ -62,7 +62,10 @@ -
+
{{ t('signed_with') }} - Powered by - <%= Docuseal::PRODUCT_NAME %> - open source documents software -
+<%= render 'shared/powered_by' %> diff --git a/app/views/shared/_powered_by.html.erb b/app/views/shared/_powered_by.html.erb new file mode 100644 index 00000000..58fbee58 --- /dev/null +++ b/app/views/shared/_powered_by.html.erb @@ -0,0 +1,4 @@ +
+ Powered by + <%= Docuseal::PRODUCT_NAME %> - open source documents software +
diff --git a/app/views/submit_form/_submission_form.html.erb b/app/views/submit_form/_submission_form.html.erb new file mode 100644 index 00000000..5bb1b814 --- /dev/null +++ b/app/views/submit_form/_submission_form.html.erb @@ -0,0 +1,3 @@ +<% data_attachments = attachments_index.values.select { |e| e.record_id == submitter.id }.to_json(only: %i[uuid], methods: %i[url filename content_type]) %> +<% data_fields = (submitter.submission.template_fields || submitter.submission.template.fields).select { |f| f['submitter_uuid'] == submitter.uuid }.to_json %> + diff --git a/app/views/submit_form/show.html.erb b/app/views/submit_form/show.html.erb index 8567844f..7813e0c4 100644 --- a/app/views/submit_form/show.html.erb +++ b/app/views/submit_form/show.html.erb @@ -33,7 +33,7 @@