mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
478167ea4f | ||
|
|
6b1c3bba19 | ||
|
|
73841f751c | ||
|
|
22dbe3291f | ||
|
|
1dac3fe434 | ||
|
|
d0c49ac04c | ||
|
|
3877dbf83f | ||
|
|
d15fd1fb84 | ||
|
|
0a105490fe | ||
|
|
0bd35b526c | ||
|
|
3a2910f717 | ||
|
|
c4a91c2b34 | ||
|
|
5643380916 | ||
|
|
cf6b378ccb | ||
|
|
66bc8cfb5f | ||
|
|
994bd1fe5c | ||
|
|
12528b6527 | ||
|
|
d135c93939 | ||
|
|
637011d55a |
No files matched your search
@@ -147,6 +147,7 @@ module Api
|
||||
def submissions_params
|
||||
permitted_attrs = [
|
||||
:send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last,
|
||||
:expire_at,
|
||||
{
|
||||
message: %i[subject body],
|
||||
submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class EmbedScriptsController < ActionController::Metal
|
||||
DUMMY_SCRIPT = <<~JAVASCRIPT.freeze
|
||||
const DummyBuilder = class extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.innerHTML = `
|
||||
<div style="text-align: center; padding: 20px; font-family: Arial, sans-serif;">
|
||||
<h2>Upgrade to Pro</h2>
|
||||
<p>Unlock embedded components by upgrading to Pro</p>
|
||||
<div style="margin-top: 40px;">
|
||||
<a href="#{Docuseal::CONSOLE_URL}/on_premise" target="_blank" style="padding: 15px 25px; background-color: #222; color: white; text-decoration: none; border-radius: 5px; font-size: 16px; cursor: pointer;">
|
||||
Learn More
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
};
|
||||
|
||||
const DummyForm = class extends DummyBuilder {};
|
||||
|
||||
if (!window.customElements.get('docuseal-builder')) {
|
||||
window.customElements.define('docuseal-builder', DummyBuilder);
|
||||
}
|
||||
|
||||
if (!window.customElements.get('docuseal-form')) {
|
||||
window.customElements.define('docuseal-form', DummyForm);
|
||||
}
|
||||
JAVASCRIPT
|
||||
|
||||
def show
|
||||
headers['Content-Type'] = 'application/javascript'
|
||||
|
||||
self.response_body = DUMMY_SCRIPT
|
||||
|
||||
self.status = 200
|
||||
end
|
||||
end
|
||||
@@ -17,7 +17,8 @@ class StartFormController < ApplicationController
|
||||
def update
|
||||
return redirect_to start_form_path(@template.slug) if @template.archived_at?
|
||||
|
||||
@submitter = Submitter.where(submission: @template.submissions.where(archived_at: nil))
|
||||
@submitter = Submitter.where(submission: @template.submissions.where(expire_at: Time.current..)
|
||||
.or(@template.submissions.where(expire_at: nil)).where(archived_at: nil))
|
||||
.order(id: :desc)
|
||||
.then { |rel| params[:resubmit].present? ? rel.where(completed_at: nil) : rel }
|
||||
.find_or_initialize_by(**submitter_params.compact_blank)
|
||||
|
||||
@@ -14,6 +14,7 @@ class SubmitFormController < ApplicationController
|
||||
|
||||
return redirect_to submit_form_completed_path(@submitter.slug) if @submitter.completed_at?
|
||||
return render :archived if @submitter.submission.template.archived_at? || @submitter.submission.archived_at?
|
||||
return render :expired if @submitter.submission.expired?
|
||||
|
||||
Submitters.preload_with_pages(@submitter)
|
||||
|
||||
@@ -51,6 +52,10 @@ class SubmitFormController < ApplicationController
|
||||
return render json: { error: 'Form has been archived.' }, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
if submitter.submission.expired?
|
||||
return render json: { error: 'Form has been expired.' }, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
Submitters::SubmitValues.call(submitter, params, request)
|
||||
|
||||
head :ok
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WebhookSecretController < ApplicationController
|
||||
before_action :load_encrypted_config
|
||||
authorize_resource :encrypted_config, parent: false
|
||||
|
||||
def index; end
|
||||
|
||||
def create
|
||||
@encrypted_config.assign_attributes(value: {
|
||||
encrypted_config_params[:key] => encrypted_config_params[:value]
|
||||
}.compact_blank)
|
||||
|
||||
@encrypted_config.value.present? ? @encrypted_config.save! : @encrypted_config.delete
|
||||
|
||||
redirect_back(fallback_location: settings_webhooks_path, notice: 'Webhook Secret has been saved.')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_encrypted_config
|
||||
@encrypted_config =
|
||||
current_account.encrypted_configs.find_or_initialize_by(key: EncryptedConfig::WEBHOOK_SECRET_KEY)
|
||||
end
|
||||
|
||||
def encrypted_config_params
|
||||
params.require(:encrypted_config).permit(value: %i[key value]).fetch(:value, {})
|
||||
end
|
||||
end
|
||||
@@ -24,6 +24,7 @@ import SubmitForm from './elements/submit_form'
|
||||
import PromptPassword from './elements/prompt_password'
|
||||
import EmailsTextarea from './elements/emails_textarea'
|
||||
import ToggleOnSubmit from './elements/toggle_on_submit'
|
||||
import PasswordInput from './elements/password_input'
|
||||
|
||||
import * as TurboInstantClick from './lib/turbo_instant_click'
|
||||
|
||||
@@ -85,6 +86,7 @@ safeRegisterElement('prompt-password', PromptPassword)
|
||||
safeRegisterElement('emails-textarea', EmailsTextarea)
|
||||
safeRegisterElement('toggle-cookies', ToggleCookies)
|
||||
safeRegisterElement('toggle-on-submit', ToggleOnSubmit)
|
||||
safeRegisterElement('password-input', PasswordInput)
|
||||
|
||||
safeRegisterElement('template-builder', class extends HTMLElement {
|
||||
connectedCallback () {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { target, targetable } from '@github/catalyst/lib/targetable'
|
||||
|
||||
export default targetable(class extends HTMLElement {
|
||||
static [target.static] = [
|
||||
'visiblePasswordIcon',
|
||||
'hiddenPasswordIcon',
|
||||
'passwordInput',
|
||||
'togglePasswordVisibility'
|
||||
]
|
||||
|
||||
connectedCallback () {
|
||||
this.togglePasswordVisibility.addEventListener('click', this.handleTogglePasswordVisibility)
|
||||
document.addEventListener('turbo:submit-start', this.setInitialPasswordType)
|
||||
}
|
||||
|
||||
disconnectedCallback () {
|
||||
this.togglePasswordVisibility.removeEventListener('click', this.handleTogglePasswordVisibility)
|
||||
document.removeEventListener('turbo:submit-start', this.setInitialPasswordType)
|
||||
}
|
||||
|
||||
handleTogglePasswordVisibility = () => {
|
||||
this.passwordInput.type = this.passwordInput.type === 'password' ? 'text' : 'password'
|
||||
this.toggleIcon()
|
||||
}
|
||||
|
||||
setInitialPasswordType = () => {
|
||||
this.passwordInput.type = 'password'
|
||||
this.toggleIcon()
|
||||
}
|
||||
|
||||
toggleIcon = () => {
|
||||
this.visiblePasswordIcon.classList.toggle('hidden', this.passwordInput.type === 'password')
|
||||
this.hiddenPasswordIcon.classList.toggle('hidden', this.passwordInput.type === 'text')
|
||||
}
|
||||
})
|
||||
@@ -43,6 +43,7 @@
|
||||
:required="field.required"
|
||||
type="date"
|
||||
:name="`values[${field.uuid}]`"
|
||||
@keydown.enter="onEnter"
|
||||
@focus="$emit('focus')"
|
||||
>
|
||||
</div>
|
||||
@@ -78,7 +79,7 @@ export default {
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
emits: ['update:model-value', 'focus'],
|
||||
emits: ['update:model-value', 'focus', 'submit'],
|
||||
computed: {
|
||||
value: {
|
||||
set (value) {
|
||||
@@ -90,6 +91,13 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onEnter (e) {
|
||||
if (this.modelValue) {
|
||||
e.preventDefault()
|
||||
|
||||
this.$emit('submit')
|
||||
}
|
||||
},
|
||||
setCurrentDate () {
|
||||
const inputEl = this.$refs.input
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
v-model="values[currentField.uuid]"
|
||||
:show-field-names="showFieldNames"
|
||||
:field="currentField"
|
||||
@submit="submitStep"
|
||||
@focus="scrollIntoField(currentField)"
|
||||
/>
|
||||
<div v-else-if="currentField.type === 'select'">
|
||||
@@ -388,6 +389,7 @@
|
||||
v-model="values[currentField.uuid]"
|
||||
:field="currentField"
|
||||
:submitter-slug="submitterSlug"
|
||||
:values="values"
|
||||
@attached="attachments.push($event)"
|
||||
@focus="scrollIntoField(currentField)"
|
||||
@submit="submitStep"
|
||||
@@ -808,7 +810,7 @@ export default {
|
||||
}, [])
|
||||
},
|
||||
formulaFields () {
|
||||
return this.fields.filter((f) => f.preferences?.formula)
|
||||
return this.fields.filter((f) => f.preferences?.formula && f.type !== 'payment')
|
||||
},
|
||||
attachmentsIndex () {
|
||||
return this.attachments.reduce((acc, a) => {
|
||||
@@ -1112,7 +1114,9 @@ export default {
|
||||
if (response.status === 422 || response.status === 500) {
|
||||
const data = await response.json()
|
||||
|
||||
alert(data.error || 'Value is invalid')
|
||||
const i18nError = data.error ? this.t(data.error.replace(/\s+/g, '_').toLowerCase()) : ''
|
||||
|
||||
alert(i18nError !== data.error ? i18nError : (data.error || this.t('value_is_invalid')))
|
||||
|
||||
return Promise.reject(new Error(data.error))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ const en = {
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan the QR code with the camera app to open the form on mobile and draw your signature',
|
||||
date: 'Date',
|
||||
number: 'Number',
|
||||
value_is_invalid: 'Value is invalid',
|
||||
verification_code_is_invalid: 'Verification code is invalid',
|
||||
already_paid: 'Already paid',
|
||||
image: 'Image',
|
||||
pay: 'Pay',
|
||||
@@ -75,6 +77,8 @@ const en = {
|
||||
}
|
||||
|
||||
const es = {
|
||||
value_is_invalid: 'El valor no es válido',
|
||||
verification_code_is_invalid: 'El código de verificación no es válido',
|
||||
drawn_signature_on_a_touchscreen_device: 'Firma dibujada en un dispositivo con pantalla táctil',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escanea el código QR con la aplicación de la cámara para abrir el formulario en el móvil y dibujar tu firma',
|
||||
by_clicking_you_agree_to_the: 'Al hacer clic en "{button}", usted acepta el',
|
||||
@@ -150,6 +154,8 @@ const es = {
|
||||
}
|
||||
|
||||
const it = {
|
||||
value_is_invalid: 'Il valore non è valido',
|
||||
verification_code_is_invalid: 'Il codice di verifica non è valido',
|
||||
drawn_signature_on_a_touchscreen_device: 'Firma disegnata su un dispositivo con schermo tattile',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scansiona il codice QR con l\'app della fotocamera per aprire il modulo sul cellulare e disegnare la tua firma',
|
||||
by_clicking_you_agree_to_the: 'Cliccando su "{button}", accetti il',
|
||||
@@ -225,6 +231,8 @@ const it = {
|
||||
}
|
||||
|
||||
const de = {
|
||||
value_is_invalid: 'Wert ist ungültig',
|
||||
verification_code_is_invalid: 'Bestätigungscode ist ungültig',
|
||||
drawn_signature_on_a_touchscreen_device: 'Gezeichnete Unterschrift auf einem Touchscreen-Gerät',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannen Sie den QR-Code mit der Kamera-App, um das Formular auf dem Handy zu öffnen und Ihre Unterschrift zu zeichnen',
|
||||
by_clicking_you_agree_to_the: 'Durch Klicken auf "{button}" stimmen Sie zu, dass Sie die',
|
||||
@@ -300,6 +308,8 @@ const de = {
|
||||
}
|
||||
|
||||
const fr = {
|
||||
value_is_invalid: 'La valeur est invalide',
|
||||
verification_code_is_invalid: 'Le code de vérification est invalide',
|
||||
drawn_signature_on_a_touchscreen_device: 'Signature dessinée sur un appareil à écran tactile',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scannez le code QR avec l\'application de l\'appareil photo pour ouvrir le formulaire sur mobile et dessiner votre signature',
|
||||
by_clicking_you_agree_to_the: 'En cliquant sur "{button}", vous acceptez la',
|
||||
@@ -375,6 +385,8 @@ const fr = {
|
||||
}
|
||||
|
||||
const pl = {
|
||||
value_is_invalid: 'Wartość jest nieprawidłowa',
|
||||
verification_code_is_invalid: 'Kod weryfikacyjny jest nieprawidłowy',
|
||||
drawn_signature_on_a_touchscreen_device: 'Podpis odręczny na urządzeniu z ekranem dotykowym',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Zeskanuj kod QR za pomocą aplikacji aparatu, aby otworzyć formularz na telefonie i narysować swój podpis',
|
||||
by_clicking_you_agree_to_the: 'Klikając na "{button}", zgadzasz się na',
|
||||
@@ -450,6 +462,8 @@ const pl = {
|
||||
}
|
||||
|
||||
const uk = {
|
||||
value_is_invalid: 'Значення є неправильним',
|
||||
verification_code_is_invalid: 'Код підтвердження є неправильним',
|
||||
drawn_signature_on_a_touchscreen_device: 'Підпис на сенсорному пристрої',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Скануйте QR-код за допомогою програми камери, щоб відкрити форму на мобільному пристрої та намалювати свій підпис',
|
||||
by_clicking_you_agree_to_the: 'Натиснувши на "{button}", ви погоджуєтеся з',
|
||||
@@ -525,6 +539,8 @@ const uk = {
|
||||
}
|
||||
|
||||
const cs = {
|
||||
value_is_invalid: 'Hodnota je neplatná',
|
||||
verification_code_is_invalid: 'Ověřovací kód je neplatný',
|
||||
drawn_signature_on_a_touchscreen_device: 'Namalovaný podpis na dotykovém zařízení',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Naskenujte QR kód pomocí aplikace fotoaparátu, abyste otevřeli formulář na mobilním zařízení a nakreslili svůj podpis',
|
||||
by_clicking_you_agree_to_the: 'Kliknutím na "{button}" souhlasíte s',
|
||||
@@ -600,6 +616,8 @@ const cs = {
|
||||
}
|
||||
|
||||
const pt = {
|
||||
value_is_invalid: 'Valor é inválido',
|
||||
verification_code_is_invalid: 'Código de verificação é inválido',
|
||||
drawn_signature_on_a_touchscreen_device: 'Assinatura desenhada em um dispositivo com tela sensível ao toque',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escaneie o código QR com o aplicativo da câmera para abrir o formulário no celular e desenhar sua assinatura',
|
||||
by_clicking_you_agree_to_the: 'Ao clicar em "{button}", você concorda com o',
|
||||
@@ -675,6 +693,8 @@ const pt = {
|
||||
}
|
||||
|
||||
const he = {
|
||||
value_is_invalid: 'ערך לא תקין',
|
||||
verification_code_is_invalid: 'קוד האימות אינו תקין',
|
||||
drawn_signature_on_a_touchscreen_device: 'חתימה שנוצרה במכשיר עם מסך מגע',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'סרוק את קוד ה-QR באמצעות אפליקציית המצלמה כדי לפתוח את הטופס במובייל ולצייר את החתימה שלך',
|
||||
by_clicking_you_agree_to_the: 'על ידי לחיצה על "{button}", אתה מסכים ל',
|
||||
@@ -751,6 +771,8 @@ const he = {
|
||||
}
|
||||
|
||||
const nl = {
|
||||
value_is_invalid: 'Waarde is ongeldig',
|
||||
verification_code_is_invalid: 'Verificatiecode is ongeldig',
|
||||
drawn_signature_on_a_touchscreen_device: 'Getekende handtekening op een apparaat met een touchscreen',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan de QR-code met de camera-app om het formulier op mobiel te openen en uw handtekening te tekenen',
|
||||
by_clicking_you_agree_to_the: 'Door op "{button}" te klikken, gaat u akkoord met de',
|
||||
@@ -827,6 +849,8 @@ const nl = {
|
||||
}
|
||||
|
||||
const ar = {
|
||||
value_is_invalid: 'القيمة غير صالحة',
|
||||
verification_code_is_invalid: 'رمز التحقق غير صالح',
|
||||
drawn_signature_on_a_touchscreen_device: 'توقيع مرسوم على جهاز بشاشة تعمل باللمس',
|
||||
scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'امسح رمز الاستجابة السريعة باستخدام تطبيق الكاميرا لفتح النموذج على الهاتف المحمول ورسم توقيعك',
|
||||
by_clicking_you_agree_to_the: 'بالنقر فوق "{button}"، أنت توافق على',
|
||||
|
||||
@@ -51,7 +51,17 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
items () {
|
||||
return snarkdown(this.string.replace(/\n/g, '<br>')).split(htmlSplitRegexp)
|
||||
const linkParts = this.string.split(/(https?:\/\/[^\s)]+)/g)
|
||||
|
||||
const text = linkParts.map((part, index) => {
|
||||
if (part.match(/^https?:\/\//) && !linkParts[index - 1]?.match(/\(\s*$/) && !linkParts[index + 1]?.match(/^\s*\)/)) {
|
||||
return `[${part}](${part})`
|
||||
} else {
|
||||
return part
|
||||
}
|
||||
}).join('')
|
||||
|
||||
return snarkdown(text.replace(/\n/g, '<br>')).split(htmlSplitRegexp)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -93,6 +93,10 @@ export default {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
values: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
submitterSlug: {
|
||||
type: String,
|
||||
required: true
|
||||
@@ -101,7 +105,8 @@ export default {
|
||||
emits: ['focus', 'submit', 'update:model-value', 'attached'],
|
||||
data () {
|
||||
return {
|
||||
isCreatingCheckout: false
|
||||
isCreatingCheckout: false,
|
||||
isMathLoaded: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -114,15 +119,23 @@ export default {
|
||||
defaultName () {
|
||||
const { price, currency } = this.field.preferences || {}
|
||||
|
||||
const formattedPrice = new Intl.NumberFormat([], {
|
||||
const formatter = new Intl.NumberFormat([], {
|
||||
style: 'currency',
|
||||
currency
|
||||
}).format(price)
|
||||
})
|
||||
|
||||
return this.t('pay') + ' ' + formattedPrice
|
||||
if (this.field.preferences?.formula) {
|
||||
if (this.isMathLoaded) {
|
||||
return this.t('pay') + ' ' + formatter.format(this.calculateFormula())
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return this.t('pay') + ' ' + formatter.format(price)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
async mounted () {
|
||||
if (this.sessionId) {
|
||||
this.$emit('submit')
|
||||
}
|
||||
@@ -130,8 +143,48 @@ export default {
|
||||
if (!this.sessionId) {
|
||||
this.postCheckout({ checkStatus: true })
|
||||
}
|
||||
|
||||
if (this.field.preferences?.formula) {
|
||||
const {
|
||||
create,
|
||||
evaluateDependencies,
|
||||
addDependencies,
|
||||
subtractDependencies,
|
||||
divideDependencies,
|
||||
multiplyDependencies,
|
||||
powDependencies,
|
||||
roundDependencies,
|
||||
absDependencies,
|
||||
sinDependencies,
|
||||
tanDependencies,
|
||||
cosDependencies
|
||||
} = await import('mathjs')
|
||||
|
||||
this.math = create({
|
||||
evaluateDependencies,
|
||||
addDependencies,
|
||||
subtractDependencies,
|
||||
divideDependencies,
|
||||
multiplyDependencies,
|
||||
powDependencies,
|
||||
roundDependencies,
|
||||
absDependencies,
|
||||
sinDependencies,
|
||||
tanDependencies,
|
||||
cosDependencies
|
||||
})
|
||||
|
||||
this.isMathLoaded = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateFormula () {
|
||||
const transformedFormula = this.field.preferences.formula.replace(/{{(.*?)}}/g, (match, uuid) => {
|
||||
return this.values[uuid] || 0.0
|
||||
})
|
||||
|
||||
return this.math.evaluate(transformedFormula.toLowerCase())
|
||||
},
|
||||
async submit () {
|
||||
if (this.sessionId) {
|
||||
return fetch(this.baseUrl + '/api/stripe_payments/' + this.sessionId, {
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
:field="field"
|
||||
@click-condition="isShowConditionsModal = true"
|
||||
@click-description="isShowDescriptionModal = true"
|
||||
@click-formula="isShowFormulaModal = true"
|
||||
/>
|
||||
<span
|
||||
v-else-if="field.type !== 'heading'"
|
||||
@@ -345,7 +346,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
buildDefaultName (field, fields) {
|
||||
if (field.type === 'payment' && field.preferences?.price) {
|
||||
if (field.type === 'payment' && field.preferences?.price && !field.preferences?.formula) {
|
||||
const { price, currency } = field.preferences || {}
|
||||
|
||||
const formattedPrice = new Intl.NumberFormat([], {
|
||||
|
||||
@@ -204,7 +204,10 @@ export default {
|
||||
alert('Some fields are missing in the formula.')
|
||||
} else {
|
||||
this.field.preferences.formula = normalizedFormula
|
||||
this.field.readonly = !!normalizedFormula
|
||||
|
||||
if (this.field.type !== 'payment') {
|
||||
this.field.readonly = !!normalizedFormula
|
||||
}
|
||||
|
||||
this.save()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ const en = {
|
||||
display_title: 'Display title',
|
||||
with_logo: 'With logo',
|
||||
unchecked: 'Unchecked',
|
||||
price: 'Price',
|
||||
type_value: 'Type value',
|
||||
equal: 'Equal',
|
||||
not_equal: 'Not equal',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<span
|
||||
class="dropdown dropdown-end"
|
||||
:class="{ 'dropdown-open': (!field.preferences?.price || !isConnected) && !isLoading }"
|
||||
:class="{ 'dropdown-open': ((!field.preferences?.price && !field.preferences?.formula) || !isConnected) && !isLoading }"
|
||||
>
|
||||
<label
|
||||
tabindex="0"
|
||||
@@ -26,7 +26,7 @@
|
||||
>
|
||||
<select
|
||||
v-model="field.preferences.currency"
|
||||
placeholder="Price"
|
||||
:placeholder="t('price')"
|
||||
class="select select-bordered select-xs font-normal w-full max-w-xs !h-7 !outline-0"
|
||||
@change="save"
|
||||
>
|
||||
@@ -51,14 +51,23 @@
|
||||
@click.stop
|
||||
>
|
||||
<input
|
||||
v-if="field.preferences.formula"
|
||||
type="number"
|
||||
:placeholder="t('price')"
|
||||
disabled="true"
|
||||
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0"
|
||||
@blur="save"
|
||||
>
|
||||
<input
|
||||
v-else
|
||||
v-model="field.preferences.price"
|
||||
type="number"
|
||||
placeholder="Price"
|
||||
:placeholder="t('price')"
|
||||
class="input input-bordered input-xs w-full max-w-xs h-7 !outline-0"
|
||||
@blur="save"
|
||||
>
|
||||
<label
|
||||
v-if="field.preferences.price"
|
||||
v-if="field.preferences.price && !field.preferences.formula"
|
||||
:style="{ backgroundColor: backgroundColor }"
|
||||
class="absolute -top-1 left-2.5 px-1 h-4"
|
||||
style="font-size: 8px"
|
||||
@@ -149,8 +158,21 @@
|
||||
data-turbo="false"
|
||||
>Learn more</a>
|
||||
</div>
|
||||
<li class="mb-1">
|
||||
<label
|
||||
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||
@click="$emit('click-formula')"
|
||||
>
|
||||
<IconMathFunction
|
||||
width="18"
|
||||
/>
|
||||
<span class="text-sm">
|
||||
{{ t('formula') }}
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
<hr>
|
||||
<li class="mt-1">
|
||||
<li>
|
||||
<label
|
||||
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||
@click="$emit('click-description')"
|
||||
@@ -181,7 +203,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { IconSettings, IconCircleCheck, IconInfoCircle, IconBrandStripe, IconInnerShadowTop, IconRouteAltLeft } from '@tabler/icons-vue'
|
||||
import { IconMathFunction, IconSettings, IconCircleCheck, IconInfoCircle, IconBrandStripe, IconInnerShadowTop, IconRouteAltLeft } from '@tabler/icons-vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const isConnected = ref(false)
|
||||
@@ -193,6 +215,7 @@ export default {
|
||||
IconCircleCheck,
|
||||
IconRouteAltLeft,
|
||||
IconInfoCircle,
|
||||
IconMathFunction,
|
||||
IconInnerShadowTop,
|
||||
IconBrandStripe
|
||||
},
|
||||
@@ -203,7 +226,7 @@ export default {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
emits: ['click-condition', 'click-description'],
|
||||
emits: ['click-condition', 'click-description', 'click-formula'],
|
||||
data () {
|
||||
return {
|
||||
isLoading: false
|
||||
|
||||
@@ -14,7 +14,7 @@ class SendFormCompletedWebhookRequestJob
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
|
||||
url = load_url(submitter, params)
|
||||
url, secret = load_url_and_secret(submitter, params)
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -29,6 +29,7 @@ class SendFormCompletedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Submitters::SerializeForWebhook.call(submitter)
|
||||
}.to_json,
|
||||
**secret.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
@@ -45,9 +46,11 @@ class SendFormCompletedWebhookRequestJob
|
||||
end
|
||||
end
|
||||
|
||||
def load_url(submitter, params)
|
||||
def load_url_and_secret(submitter, params)
|
||||
if params['encrypted_config_id']
|
||||
url = EncryptedConfig.find(params['encrypted_config_id']).value
|
||||
config = EncryptedConfig.find(params['encrypted_config_id'])
|
||||
|
||||
url = config.value
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -55,7 +58,10 @@ class SendFormCompletedWebhookRequestJob
|
||||
|
||||
return if preferences['form.completed'] == false
|
||||
|
||||
url
|
||||
secret = EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h
|
||||
|
||||
[url, secret]
|
||||
elsif params['webhook_url_id']
|
||||
webhook_url = submitter.account.webhook_urls.find(params['webhook_url_id'])
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ class SendFormStartedWebhookRequestJob
|
||||
submitter = Submitter.find(params['submitter_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(submitter.submission.account)
|
||||
config = Accounts.load_webhook_config(submitter.submission.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -30,6 +31,8 @@ class SendFormStartedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Submitters::SerializeForWebhook.call(submitter)
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -13,7 +13,8 @@ class SendFormViewedWebhookRequestJob
|
||||
submitter = Submitter.find(params['submitter_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(submitter.submission.account)
|
||||
config = Accounts.load_webhook_config(submitter.submission.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -30,6 +31,8 @@ class SendFormViewedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Submitters::SerializeForWebhook.call(submitter)
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -13,7 +13,9 @@ class SendSubmissionArchivedWebhookRequestJob
|
||||
submission = Submission.find(params['submission_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(submission.account)
|
||||
|
||||
config = Accounts.load_webhook_config(submission.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -28,6 +30,8 @@ class SendSubmissionArchivedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: submission.as_json(only: %i[id archived_at])
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -13,7 +13,9 @@ class SendSubmissionCreatedWebhookRequestJob
|
||||
submission = Submission.find(params['submission_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(submission.account)
|
||||
|
||||
config = Accounts.load_webhook_config(submission.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -28,6 +30,8 @@ class SendSubmissionCreatedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Submissions::SerializeForApi.call(submission)
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -13,7 +13,9 @@ class SendTemplateCreatedWebhookRequestJob
|
||||
template = Template.find(params['template_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(template.account)
|
||||
|
||||
config = Accounts.load_webhook_config(template.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -28,6 +30,8 @@ class SendTemplateCreatedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Templates::SerializeForApi.call(template)
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -13,7 +13,9 @@ class SendTemplateUpdatedWebhookRequestJob
|
||||
template = Template.find(params['template_id'])
|
||||
|
||||
attempt = params['attempt'].to_i
|
||||
url = Accounts.load_webhook_url(template.account)
|
||||
|
||||
config = Accounts.load_webhook_config(template.account)
|
||||
url = config&.value.presence
|
||||
|
||||
return if url.blank?
|
||||
|
||||
@@ -28,6 +30,8 @@ class SendTemplateUpdatedWebhookRequestJob
|
||||
timestamp: Time.current,
|
||||
data: Templates::SerializeForApi.call(template)
|
||||
}.to_json,
|
||||
**EncryptedConfig.find_or_initialize_by(account_id: config.account_id,
|
||||
key: EncryptedConfig::WEBHOOK_SECRET_KEY)&.value.to_h,
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => USER_AGENT)
|
||||
rescue Faraday::Error
|
||||
|
||||
@@ -6,6 +6,8 @@ class SubmitterMailer < ApplicationMailer
|
||||
|
||||
DEFAULT_INVITATION_SUBJECT = 'You are invited to submit a form'
|
||||
|
||||
NO_REPLY_REGEXP = /no-?reply@/i
|
||||
|
||||
def invitation_email(submitter)
|
||||
@current_account = submitter.submission.account
|
||||
@submitter = submitter
|
||||
@@ -28,12 +30,13 @@ class SubmitterMailer < ApplicationMailer
|
||||
|
||||
assign_message_metadata('submitter_invitation', @submitter)
|
||||
|
||||
reply_to = build_submitter_reply_to(@submitter)
|
||||
|
||||
mail(
|
||||
to: @submitter.friendly_name,
|
||||
from: from_address_for_submitter(submitter),
|
||||
subject:,
|
||||
reply_to: submitter.preferences['reply_to'].presence ||
|
||||
(submitter.submission.created_by_user || submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@')
|
||||
reply_to:
|
||||
)
|
||||
end
|
||||
|
||||
@@ -104,16 +107,26 @@ class SubmitterMailer < ApplicationMailer
|
||||
|
||||
assign_message_metadata('submitter_documents_copy', @submitter)
|
||||
|
||||
reply_to = build_submitter_reply_to(submitter)
|
||||
|
||||
mail(from: from_address_for_submitter(submitter),
|
||||
to: to || @submitter.friendly_name,
|
||||
reply_to: @submitter.preferences['reply_to'].presence ||
|
||||
(@submitter.submission.created_by_user ||
|
||||
@submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@'),
|
||||
reply_to:,
|
||||
subject:)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_submitter_reply_to(submitter)
|
||||
reply_to =
|
||||
submitter.preferences['reply_to'].presence ||
|
||||
(submitter.submission.created_by_user || submitter.template.author)&.friendly_name&.sub(/\+\w+@/, '@')
|
||||
|
||||
return nil if reply_to.to_s.match?(NO_REPLY_REGEXP)
|
||||
|
||||
reply_to
|
||||
end
|
||||
|
||||
def build_completed_subject(submitter)
|
||||
submitters = submitter.submission.submitters.order(:completed_at)
|
||||
.map { |e| e.name || e.email || e.phone }.join(', ')
|
||||
|
||||
@@ -27,7 +27,8 @@ class EncryptedConfig < ApplicationRecord
|
||||
ESIGN_CERTS_KEY = 'esign_certs',
|
||||
TIMESTAMP_SERVER_URL_KEY = 'timestamp_server_url',
|
||||
APP_URL_KEY = 'app_url',
|
||||
WEBHOOK_URL_KEY = 'webhook_url'
|
||||
WEBHOOK_URL_KEY = 'webhook_url',
|
||||
WEBHOOK_SECRET_KEY = 'webhook_secret'
|
||||
].freeze
|
||||
|
||||
belongs_to :account
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# archived_at :datetime
|
||||
# expire_at :datetime
|
||||
# preferences :text not null
|
||||
# slug :string not null
|
||||
# source :text not null
|
||||
@@ -75,6 +76,10 @@ class Submission < ApplicationRecord
|
||||
preserved: 'preserved'
|
||||
}, scope: false, prefix: true
|
||||
|
||||
def expired?
|
||||
expire_at && expire_at <= Time.current
|
||||
end
|
||||
|
||||
def audit_trail_url
|
||||
return if audit_trail.blank?
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
|
||||
<path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 431 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828" />
|
||||
<path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87" />
|
||||
<path d="M3 3l18 18" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 572 B |
@@ -34,7 +34,17 @@
|
||||
<%= fields_for @user do |ff| %>
|
||||
<div class="form-control">
|
||||
<%= ff.label :password, class: 'label' %>
|
||||
<%= ff.password_field :password, required: true, placeholder: '************', class: 'base-input' %>
|
||||
<password-input class="block relative">
|
||||
<%= ff.password_field :password, required: true, placeholder: '************', class: 'base-input w-full pr-10', data: { target: 'password-input.passwordInput' } %>
|
||||
<button data-target="password-input.togglePasswordVisibility" type="button" class="absolute inset-y-0 h-12 right-0 pr-3 flex items-center">
|
||||
<span data-target="password-input.hiddenPasswordIcon">
|
||||
<%= svg_icon('eye', class: 'w-6 h-6 shrink-0 bg-white') %>
|
||||
</span>
|
||||
<span data-target="password-input.visiblePasswordIcon" class="hidden">
|
||||
<%= svg_icon('eye_off', class: 'w-6 h-6 shrink-0 bg-white') %>
|
||||
</span>
|
||||
</button>
|
||||
</password-input>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= fields_for @encrypted_config do |ff| %>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% elsif field['type'] == 'cells' && area['cell_w'] %>
|
||||
<% elsif field['type'] == 'cells' && area['cell_w'].to_f > 0.0 %>
|
||||
<% cell_width = area['cell_w'] / area['w'] * 100 %>
|
||||
<div class="w-full flex items-center">
|
||||
<% (0..(area['w'] / area['cell_w']).ceil).each do |index| %>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @submission.submitters.to_a.size == 1 %>
|
||||
<% elsif @submission.submitters.to_a.size == 1 && !@submission.expired? %>
|
||||
<%= 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 %>
|
||||
</div>
|
||||
@@ -146,15 +146,15 @@
|
||||
<%= submitter&.completed_at? ? l(submitter.completed_at.in_time_zone(@submission.account.timezone), format: :long, locale: @submission.account.locale) : 'Not completed yet' %>
|
||||
</span>
|
||||
</div>
|
||||
<% if signed_in? && submitter && submitter.email && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && Accounts.can_send_emails?(current_account) %>
|
||||
<% if signed_in? && submitter && submitter.email && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && Accounts.can_send_emails?(current_account) && !@submission.expired? %>
|
||||
<div class="mt-2 mb-1">
|
||||
<%= button_to button_title(title: submitter.sent_at? ? 'Re-send Email' : 'Send Email', disabled_with: 'Sending'), submitter_send_email_index_path(submitter_slug: submitter.slug), class: 'btn btn-sm btn-primary w-full' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if signed_in? && submitter && submitter.phone && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) %>
|
||||
<% if signed_in? && submitter && submitter.phone && !submitter.completed_at && !@submission.archived_at? && can?(:update, submitter) && !@submission.expired? %>
|
||||
<%= render 'submissions/send_sms_button', submitter: %>
|
||||
<% end %>
|
||||
<% if signed_in? && submitter && !submitter.completed_at? && !@submission.archived_at? && can?(:create, submitter) %>
|
||||
<% if signed_in? && submitter && !submitter.completed_at? && !@submission.archived_at? && can?(:create, submitter) && !@submission.expired? %>
|
||||
<div class="mt-2 mb-1">
|
||||
<a class="btn btn-sm btn-primary w-full" target="_blank" href="<%= submit_form_path(slug: submitter.slug) %>">
|
||||
Sign In-person
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="max-w-md mx-auto px-2 mt-12 mb-4">
|
||||
<div class="space-y-6 mx-auto">
|
||||
<div class="space-y-6">
|
||||
<div class="flex items-center justify-center">
|
||||
<%= render 'start_form/banner' %>
|
||||
</div>
|
||||
<div class="flex items-center bg-base-200 rounded-xl p-4 mb-4">
|
||||
<div class="flex items-center">
|
||||
<div class="mr-3">
|
||||
<%= svg_icon('writing_sign', class: 'w-10 h-10') %>
|
||||
</div>
|
||||
<div dir="auto">
|
||||
<p class="text-lg font-bold mb-1"><%= @submitter.submission.template.name %></p>
|
||||
<p class="text-sm"><%= t('form_expired_at_html', time: l(@submitter.submission.expire_at, format: :long)) %></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= render 'shared/attribution', link_path: '/start', account: @submitter.account %>
|
||||
@@ -34,11 +34,19 @@
|
||||
<% submitter = submitters.first %>
|
||||
<div class="flex items-center space-x-4">
|
||||
<span class="flex flex-col md:flex-row md:items-center gap-3">
|
||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
|
||||
<%= submitter.status %>
|
||||
</span>
|
||||
</div>
|
||||
<% if submission.expired? %>
|
||||
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||
Expired
|
||||
</span>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||
<span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
|
||||
<%= submitter.status %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<span class="text-lg break-all flex items-center">
|
||||
<%= submitter.name || submitter.email || submitter.phone %>
|
||||
</span>
|
||||
@@ -61,7 +69,7 @@
|
||||
</download-button>
|
||||
</button>
|
||||
</form>
|
||||
<% elsif !submission.archived_at? && !template.archived_at? %>
|
||||
<% elsif !submission.archived_at? && !template.archived_at? && !submission.expired? %>
|
||||
<% if current_user.email == submitter.email %>
|
||||
<form data-turbo="false" method="get" action="<%= submit_form_url(slug: submitter.slug) %>" class="flex-1 md:flex-none">
|
||||
<button onclick="event.stopPropagation()" class="btn btn-sm btn-neutral btn-outline bg-white w-full md:w-36 flex">
|
||||
@@ -82,7 +90,7 @@
|
||||
</div>
|
||||
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
|
||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
||||
@@ -101,12 +109,18 @@
|
||||
<%= latest_submitter.status %>
|
||||
</span>
|
||||
</div>
|
||||
<% elsif submission.expired? %>
|
||||
<div class="tooltip flex" data-tip="<%= l(submission.expire_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||
<span class="badge badge-error md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
|
||||
Expired
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="w-full <%= is_submission_completed ? 'space-y-1' : 'space-y-4' %> md:space-y-0">
|
||||
<% submitters.each_with_index do |submitter, index| %>
|
||||
<div class="relative flex justify-between items-start md:items-center space-x-3">
|
||||
<span class="flex flex-col md:flex-row md:items-center gap-2">
|
||||
<% unless is_submission_completed %>
|
||||
<% if !is_submission_completed && !submission.expired? %>
|
||||
<div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
|
||||
<span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
|
||||
<%= submitter.status %>
|
||||
@@ -132,7 +146,7 @@
|
||||
</download-button>
|
||||
</button>
|
||||
</form>
|
||||
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed %>
|
||||
<% elsif !template.archived_at? && !submission.archived_at? && !is_submission_completed && !submission.expired? %>
|
||||
<div class="relative flex items-center space-x-3">
|
||||
<% if current_user.email == submitter.email %>
|
||||
<form data-turbo="false" method="get" action="<%= submit_form_url(slug: submitter.slug) %>">
|
||||
@@ -178,7 +192,7 @@
|
||||
</div>
|
||||
<% if !submission.archived_at? && !template.archived_at? %>
|
||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
|
||||
<%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<% end %>
|
||||
<% if can?(:destroy, template) %>
|
||||
<span class="tooltip tooltip-left" data-tip="<%= template.archived_at? ? 'Delete' : 'Archive' %>">
|
||||
<%= button_to template_path(template), data: { turbo_confirm: template.archived_at? ? 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' : 'Are you sure?' }, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %>
|
||||
<%= button_to template_path(template), data: template.archived_at? ? { turbo_confirm: 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' } : {}, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %>
|
||||
<%= svg_icon(template.archived_at? ? 'trash' : 'archive', class: 'w-4 h-4 enabled') %>
|
||||
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<%= render 'shared/turbo_modal', title: 'Webhook Secret' do %>
|
||||
<%= form_for @encrypted_config, url: webhook_secret_index_path, method: :post, html: { class: 'space-y-4' }, data: { turbo_frame: :_top } do |f| %>
|
||||
<div class="space-y-2">
|
||||
<%= f.fields_for :value, Struct.new(:key, :value).new(*@encrypted_config.value.to_a.first) do |ff| %>
|
||||
<div class="form-control">
|
||||
<%= ff.label :key, class: 'label' %>
|
||||
<%= ff.text_field :key, class: 'base-input', placeholder: 'X-Example-Header' %>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<%= ff.label :value, class: 'label' %>
|
||||
<%= ff.text_field :value, class: 'base-input' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="form-control pt-2">
|
||||
<%= f.button button_title, class: 'base-button' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -9,9 +9,12 @@
|
||||
<div class="card-body p-6">
|
||||
<%= form_for @encrypted_config, url: settings_webhooks_path, method: :post, html: { autocomplete: 'off' } do |f| %>
|
||||
<%= f.label :value, 'Webhook URL', class: 'text-sm font-semibold' %>
|
||||
<div class="flex flex-row flex-wrap space-y-2 md:space-y-0 md:flex-nowrap md:space-x-4 mt-2">
|
||||
<div class="flex flex-row flex-wrap space-y-2 md:space-y-0 md:flex-nowrap md:space-x-2 mt-2">
|
||||
<%= f.url_field :value, class: 'input font-mono input-bordered w-full', placeholder: 'https://example.com/hook' %>
|
||||
<%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button w-full md:w-32' %>
|
||||
<a href="<%= webhook_secret_index_path %>" data-turbo-frame="modal" class="white-button w-full md:w-auto">
|
||||
Add Secret
|
||||
</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% preference = current_account.account_configs.find_by(key: AccountConfig::WEBHOOK_PREFERENCES_KEY)&.value || {} %>
|
||||
|
||||
@@ -19,6 +19,7 @@ en: &en
|
||||
language_ar: العربية
|
||||
language_ko: 한국어
|
||||
email: Email
|
||||
form_expired_at_html: 'Form expired on <span class="font-semibold">%{time}</span>'
|
||||
verification_code_code: 'Verification code: %{code}'
|
||||
digitally_signed_by: Digitally signed by
|
||||
role: Role
|
||||
@@ -66,6 +67,7 @@ en: &en
|
||||
es: &es
|
||||
role: Rol
|
||||
reason: Razón
|
||||
form_expired_at_html: 'El formulario expiró el <span class="font-semibold">%{time}</span>'
|
||||
verification_code_code: 'Código de verificación: %{code}'
|
||||
email: Correo electrónico
|
||||
digitally_signed_by: Firmado digitalmente por
|
||||
@@ -111,6 +113,7 @@ it: &it
|
||||
reason: Ragione
|
||||
verification_code_code: 'Codice di verifica: %{code}'
|
||||
email: Email
|
||||
form_expired_at_html: 'Il modulo è scaduto il <span class="font-semibold">%{time}</span>'
|
||||
digitally_signed_by: Firmato digitalmente da
|
||||
role: Ruolo
|
||||
provide_your_email_to_start: Fornisci la tua email per iniziare
|
||||
@@ -154,6 +157,7 @@ fr: &fr
|
||||
digitally_signed_by: Signé numériquement par
|
||||
reason: Raison
|
||||
role: Rôle
|
||||
form_expired_at_html: 'Le formulaire a expiré le <span class="font-semibold">%{time}</span>'
|
||||
provide_your_email_to_start: Entrez votre adresse email pour commencer
|
||||
start: Démarrer
|
||||
starting: Démarrage
|
||||
@@ -196,6 +200,7 @@ pt: &pt
|
||||
reason: Razão
|
||||
verification_code_code: 'Código de verificação: %{code}'
|
||||
digitally_signed_by: Assinado digitalmente por
|
||||
form_expired_at_html: 'O formulário expirou em <span class="font-semibold">%{time}</span>'
|
||||
role: Função
|
||||
provide_your_email_to_start: Forneça o seu email para começar
|
||||
start: Iniciar
|
||||
@@ -237,6 +242,7 @@ de: &de
|
||||
verification_code_code: 'Verifizierungscode: %{code}'
|
||||
reason: Grund
|
||||
email: E-Mail
|
||||
form_expired_at_html: 'Das Formular ist am <span class="font-semibold">%{time}</span> abgelaufen'
|
||||
digitally_signed_by: Digital signiert von
|
||||
role: Rolle
|
||||
provide_your_email_to_start: Gib deine E-Mail-Adresse ein, um zu starten
|
||||
@@ -278,6 +284,7 @@ pl:
|
||||
email: Email
|
||||
verification_code_code: 'Kod weryfikacyjny: %{code}'
|
||||
digitally_signed_by: Podpis cyfrowy przez
|
||||
form_expired_at_html: 'Formularz wygasł o <span class="font-semibold">%{time}</span>'
|
||||
role: Rola
|
||||
provide_your_email_to_start: Podaj swój adres email, aby rozpocząć
|
||||
start: Rozpocznij
|
||||
@@ -321,6 +328,7 @@ uk:
|
||||
verification_code_code: 'Код підтвердження: %{code}'
|
||||
role: Роль
|
||||
provide_your_email_to_start: Введіть свій email, щоб почати
|
||||
form_expired_at_html: 'Строк подачі завершився о <span class="font-semibold">%{time}</span>'
|
||||
start: Почати
|
||||
reason: Причина
|
||||
starting: Початок
|
||||
@@ -363,6 +371,7 @@ cs:
|
||||
role: Role
|
||||
provide_your_email_to_start: Zadejte svůj email pro zahájení
|
||||
reason: Důvod
|
||||
form_expired_at_html: 'Formulář vypršel <span class="font-semibold">%{time}</span>'
|
||||
start: Zahájit
|
||||
starting: Zahajování
|
||||
form_has_been_deleted_by_html: 'Formulář byl smazán uživatelem <span class="font-semibold">%{name}</span>.'
|
||||
@@ -406,6 +415,7 @@ he:
|
||||
provide_your_email_to_start: ספק את כתובת הדוא"ל שלך כדי להתחיל
|
||||
start: התחל
|
||||
starting: מתחיל
|
||||
form_expired_at_html: 'הטופס פג תוקף ב- <span class="font-semibold">%{time}</span>'
|
||||
form_has_been_deleted_by_html: 'הטופס נמחק על ידי <span class="font-semibold">%{name}</span>.'
|
||||
invited_by_html: 'הוזמן על ידי <span class="font-semibold">%{name}</span>'
|
||||
you_have_been_invited_to_submit_a_form: הוזמנת להגיש טופס
|
||||
@@ -446,6 +456,7 @@ nl:
|
||||
provide_your_email_to_start: Geef uw e-mailadres om te beginnen
|
||||
start: Start
|
||||
reason: Reden
|
||||
form_expired_at_html: 'Formulier is verlopen op <span class="font-semibold">%{time}</span>'
|
||||
starting: Starten
|
||||
form_has_been_deleted_by_html: 'Formulier is verwijderd door <span class="font-semibold">%{name}</span>.'
|
||||
invited_by_html: 'Uitgenodigd door <span class="font-semibold">%{name}</span>'
|
||||
@@ -491,6 +502,7 @@ ar:
|
||||
form_has_been_deleted_by_html: 'تم حذف الاستمارة بواسطة <span class="font-semibold">%{name}</span>.'
|
||||
reason: سبب
|
||||
invited_by_html: 'تمت الدعوة بواسطة <span class="font-semibold">%{name}</span>'
|
||||
form_expired_at_html: 'استمارة انتهت صلاحيتها في <span class="font-semibold">%{time}</span>'
|
||||
you_have_been_invited_to_submit_a_form: تمت دعوتك لتقديم استمارة
|
||||
signed_on_time: 'تم التوقيع في %{time}'
|
||||
form_has_been_submitted_already: تم تقديم الاستمارة بالفعل
|
||||
@@ -530,6 +542,7 @@ ko:
|
||||
start: 시작
|
||||
reason: 이유
|
||||
starting: 시작 중
|
||||
form_expired_at_html: '양식이 만료되었습니다 <span class="font-semibold">%{time}</span>'
|
||||
form_has_been_deleted_by_html: '<span class="font-semibold">%{name}</span>에 의해 양식이 삭제되었습니다.'
|
||||
invited_by_html: '<span class="font-semibold">%{name}</span>에 의해 초대되었습니다.'
|
||||
you_have_been_invited_to_submit_a_form: 양식을 제출하도록 초대되었습니다.
|
||||
|
||||
@@ -75,6 +75,7 @@ Rails.application.routes.draw do
|
||||
resources :submitters_autocomplete, only: %i[index]
|
||||
resources :template_folders_autocomplete, only: %i[index]
|
||||
resources :webhook_preferences, only: %i[create]
|
||||
resources :webhook_secret, only: %i[index create]
|
||||
resource :templates_upload, only: %i[create]
|
||||
authenticated do
|
||||
resource :templates_upload, only: %i[show], path: 'new'
|
||||
@@ -166,5 +167,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
get '/js/:filename', to: 'embed_scripts#show', as: :embed_script
|
||||
|
||||
ActiveSupport.run_load_hooks(:routes, self)
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddExpireAtToSubmissions < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :submissions, :expire_at, :datetime
|
||||
end
|
||||
end
|
||||
+2
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_07_20_063827) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_08_01_125558) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -218,6 +218,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_20_063827) do
|
||||
t.string "slug", null: false
|
||||
t.text "preferences", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.datetime "expire_at"
|
||||
t.index ["account_id"], name: "index_submissions_on_account_id"
|
||||
t.index ["created_by_user_id"], name: "index_submissions_on_created_by_user_id"
|
||||
t.index ["slug"], name: "index_submissions_on_slug", unique: true
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ services:
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- .:/data
|
||||
- ./docuseal:/data/docuseal
|
||||
environment:
|
||||
- FORCE_SSL=${HOST}
|
||||
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/docuseal
|
||||
|
||||
@@ -17,6 +17,7 @@ module Submissions
|
||||
submission = template.submissions.new(created_by_user: user, source:,
|
||||
account_id: user.account_id,
|
||||
preferences: set_submission_preferences,
|
||||
expire_at: attrs[:expire_at],
|
||||
template_submitters: [], submitters_order:)
|
||||
|
||||
maybe_set_template_fields(submission, attrs[:submitters])
|
||||
|
||||
@@ -21,6 +21,8 @@ module Submissions
|
||||
A4_SIZE = [595, 842].freeze
|
||||
SUPPORTED_IMAGE_TYPES = ['image/png', 'image/jpeg'].freeze
|
||||
|
||||
TESTING_FOOTER = 'Testing Document - NOT LEGALLY BINDING'
|
||||
|
||||
MISSING_GLYPH_REPLACE = {
|
||||
'▪' => '-',
|
||||
'✔️' => 'V',
|
||||
@@ -100,18 +102,31 @@ module Submissions
|
||||
|
||||
pdfs_index = build_pdfs_index(submitter, flatten: is_flatten)
|
||||
|
||||
if with_signature_id
|
||||
if with_signature_id || submitter.account.testing?
|
||||
pdfs_index.each_value do |pdf|
|
||||
next if pdf.trailer.info[:DocumentID].present?
|
||||
|
||||
pdf.trailer.info[:DocumentID] = Digest::MD5.hexdigest(submitter.submission.slug).upcase
|
||||
document_id = Digest::MD5.hexdigest(submitter.submission.slug).upcase
|
||||
|
||||
pdf.trailer.info[:DocumentID] = document_id
|
||||
pdf.pages.each do |page|
|
||||
font_size = (([page.box.width, page.box.height].min / A4_SIZE[0].to_f) * 9).to_i
|
||||
cnv = page.canvas(type: :overlay)
|
||||
|
||||
cnv.font(FONT_NAME, size: font_size)
|
||||
cnv.text("Document ID: #{Digest::MD5.hexdigest(submitter.submission.slug).upcase}",
|
||||
at: [2, 4])
|
||||
|
||||
text =
|
||||
if submitter.account.testing?
|
||||
if with_signature_id
|
||||
"#{TESTING_FOOTER} | ID: #{document_id}"
|
||||
else
|
||||
TESTING_FOOTER
|
||||
end
|
||||
else
|
||||
"Document ID: #{document_id}"
|
||||
end
|
||||
|
||||
cnv.text(text, at: [2, 4])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -327,7 +342,7 @@ module Submissions
|
||||
width: PdfIcons::WIDTH * scale,
|
||||
height: PdfIcons::HEIGHT * scale
|
||||
)
|
||||
when ->(type) { type == 'cells' && area['cell_w'] }
|
||||
when ->(type) { type == 'cells' && !area['cell_w'].to_i.zero? }
|
||||
cell_width = area['cell_w'] * width
|
||||
|
||||
TextUtils.maybe_rtl_reverse(value).chars.each_with_index do |char, index|
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
module Submissions
|
||||
module SerializeForApi
|
||||
SERIALIZE_PARAMS = {
|
||||
only: %i[id slug source submitters_order created_at updated_at archived_at],
|
||||
only: %i[id slug source submitters_order expire_at created_at updated_at archived_at],
|
||||
methods: %i[audit_log_url],
|
||||
include: {
|
||||
submitters: { only: %i[id slug uuid name email phone
|
||||
@@ -41,7 +41,7 @@ module Submissions
|
||||
json[:completed_at] = last_submitter.completed_at
|
||||
else
|
||||
json[:documents] = []
|
||||
json[:status] = 'pending'
|
||||
json[:status] = submission.expired? ? 'expired' : 'pending'
|
||||
json[:completed_at] = nil
|
||||
end
|
||||
|
||||
|
||||
@@ -79,9 +79,7 @@ module Submitters
|
||||
else
|
||||
Date.parse(value).to_s
|
||||
end
|
||||
rescue Date::Error => e
|
||||
Rollbar.warning(e) if defined?(Rollbar)
|
||||
|
||||
rescue Date::Error
|
||||
value
|
||||
end
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ module Submitters
|
||||
def merge_formula_values(submitter)
|
||||
computed_values = submitter.submission.template_fields.each_with_object({}) do |field, acc|
|
||||
next if field['submitter_uuid'] != submitter.uuid
|
||||
next if field['type'] == 'payment'
|
||||
|
||||
formula = field.dig('preferences', 'formula')
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ module Templates
|
||||
ATTACHMENT_NAME = 'preview_images'
|
||||
|
||||
PDF_CONTENT_TYPE = 'application/pdf'
|
||||
Q = 35
|
||||
Q = ENV.fetch('PAGE_QUALITY', '35').to_i
|
||||
MAX_WIDTH = 1400
|
||||
MAX_NUMBER_OF_PAGES_PROCESSED = 15
|
||||
MAX_FLATTEN_FILE_SIZE = 20.megabytes
|
||||
|
||||
@@ -9,9 +9,17 @@ module Templates
|
||||
|
||||
module_function
|
||||
|
||||
def call(template, schema_documents = template.schema_documents, preview_image_attachments = [])
|
||||
def call(template, schema_documents = template.schema_documents.preload(:blob), preview_image_attachments = nil)
|
||||
json = template.as_json(SERIALIZE_PARAMS)
|
||||
|
||||
preview_image_attachments ||=
|
||||
ActiveStorage::Attachment.joins(:blob)
|
||||
.where(blob: { filename: '0.jpg' })
|
||||
.where(record_id: schema_documents.map(&:id),
|
||||
record_type: 'ActiveStorage::Attachment',
|
||||
name: :preview_images)
|
||||
.preload(:blob)
|
||||
|
||||
json[:documents] = template.schema.map do |item|
|
||||
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }
|
||||
|
||||
|
||||
+9
-3
@@ -32,6 +32,14 @@ module TimeUtils
|
||||
tz_info.abbreviation(time)
|
||||
end
|
||||
|
||||
def parse_time_value(value)
|
||||
if value.is_a?(Integer)
|
||||
Time.zone.at(value.to_s.first(10).to_i)
|
||||
elsif value.present?
|
||||
Time.zone.parse(value)
|
||||
end
|
||||
end
|
||||
|
||||
def parse_date_string(string, pattern)
|
||||
pattern = pattern.sub(/Y+/, YEAR_FORMATS)
|
||||
.sub(/M+/, MONTH_FORMATS)
|
||||
@@ -50,9 +58,7 @@ module TimeUtils
|
||||
.sub(/Y+/, YEAR_FORMATS[format[/Y+/]])
|
||||
|
||||
I18n.l(date, format: i18n_format, locale:)
|
||||
rescue Date::Error => e
|
||||
Rollbar.warning("#{e}: #{string}") if defined?(Rollbar)
|
||||
|
||||
rescue Date::Error
|
||||
string
|
||||
end
|
||||
end
|
||||
@@ -44,9 +44,7 @@ RSpec.describe 'Template' do
|
||||
|
||||
it 'archives a template' do
|
||||
expect do
|
||||
accept_confirm('Are you sure?') do
|
||||
click_button 'Archive'
|
||||
end
|
||||
click_button 'Archive'
|
||||
end.to change { Template.active.count }.by(-1)
|
||||
|
||||
expect(page).to have_content('Template has been archived')
|
||||
|
||||
Reference in new issue
Block a user