add optional shared link to templates

This commit is contained in:
Alex Turchyn
2025-05-26 13:32:32 +03:00
committed by Pete Matsyburka
parent c91b4a765b
commit e77b5fa2c9
21 changed files with 258 additions and 20 deletions
+14 -6
View File
@@ -11,14 +11,22 @@ class StartFormController < ApplicationController
before_action :load_template
def show
raise ActionController::RoutingError, I18n.t('not_found') if @template.preferences['require_phone_2fa'] == true
raise ActionController::RoutingError, I18n.t('not_found') if @template.preferences['require_phone_2fa']
@submitter = @template.submissions.new(account_id: @template.account_id)
.submitters.new(account_id: @template.account_id,
uuid: (filter_undefined_submitters(@template).first ||
@template.submitters.first)['uuid'])
if @template.shared_link?
@submitter = @template.submissions.new(account_id: @template.account_id)
.submitters.new(account_id: @template.account_id,
uuid: (filter_undefined_submitters(@template).first ||
@template.submitters.first)['uuid'])
@form_configs = Submitters::FormConfigs.call(@submitter) unless Docuseal.multitenant?
@form_configs = Submitters::FormConfigs.call(@submitter) unless Docuseal.multitenant?
render :show
elsif current_user && current_ability.can?(:read, @template)
render :private
else
raise ActionController::RoutingError, I18n.t('not_found')
end
end
def update