Skip to content

Commit

Permalink
update webform example 1
Browse files Browse the repository at this point in the history
  • Loading branch information
karissarjacobsen committed Oct 17, 2024
2 parents 9504c50 + a8f4679 commit 7d8e1ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
16 changes: 10 additions & 6 deletions app/controllers/webforms/weg001_create_instance_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ def create_web_form_template
access_token: session[:ds_access_token]
}

web_form_template_id = Webforms::Eg001CreateInstanceService.new(args).create_web_form_template
Utils::FileUtils.new.replace_template_id(File.join('data', Rails.application.config.web_form_config_file), web_form_template_id)
session[:web_form_template_id] = web_form_template_id

redirect_to '/weg001webForm'
begin
web_form_template_id = Webforms::Eg001CreateInstanceService.new(args).create_web_form_template
Utils::FileUtils.new.replace_template_id(File.join('data', Rails.application.config.web_form_config_file), web_form_template_id)
session[:web_form_template_id] = web_form_template_id

redirect_to '/weg001webForm'
rescue DocuSign_eSign::ApiError => e
handle_error(e)
end
end

def create_web_form_instance
Expand Down Expand Up @@ -49,7 +53,7 @@ def get_web_form_create_view

additional_page = @example['AdditionalPage'].find { |p| p['Name'] == 'create_web_form' }
@title = @example['ExampleName']
@description = additional_page['ResultsPageText']
@description = format_string(additional_page['ResultsPageText'], 'data')

render 'webforms/weg001_create_instance/web_form_create'
end
Expand Down
30 changes: 15 additions & 15 deletions app/services/webforms/eg001_create_instance_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,38 +95,38 @@ def make_web_forms_template
# Create a sign_here tab (field on the document)
sign_here = DocuSign_eSign::SignHere.new(
'documentId' => '1', 'tabLabel' => 'Signature',
'anchorString' => '/SignHere/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/SignHere/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
check = DocuSign_eSign::Checkbox.new(
'documentId' => '1', 'tabLabel' => 'Yes',
'anchorString' => '/SMS/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/SMS/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
text1 = DocuSign_eSign::Text.new(
'documentId' => '1', 'tabLabel' => 'FullName',
'anchorString' => '/FullName/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/FullName/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
text2 = DocuSign_eSign::Text.new(
'documentId' => '1', 'tabLabel' => 'PhoneNumber',
'anchorString' => '/PhoneNumber/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/PhoneNumber/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
text3 = DocuSign_eSign::Text.new(
'documentId' => '1', 'tabLabel' => 'Company',
'anchorString' => '/Company/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/Company/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
text4 = DocuSign_eSign::Text.new(
'documentId' => '1', 'tabLabel' => 'JobTitle',
'anchorString' => '/JobTitle/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/JobTitle/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)
date_signed = DocuSign_eSign::DateSigned.new(
'documentId' => '1', 'tabLabel' => 'DateSigned',
'anchorString' => '/Date/', 'anchorUnits' => 'pixel',
'anchorXOffset' => '20', 'anchorYOffset' => '10'
'anchorString' => '/Date/', 'anchorUnits' => 'pixels',
'anchorXOffset' => '0', 'anchorYOffset' => '0'
)

# Add the tabs model to the signer
Expand All @@ -139,7 +139,7 @@ def make_web_forms_template
)
# Create top two objects
envelope_template_definition = DocuSign_eSign::EnvelopeTemplate.new(
'description' => 'Example template created via the API',
'description' => 'Example template created via the eSignature API',
'shared' => 'false'
)

Expand Down
2 changes: 1 addition & 1 deletion data/web-form-config.json

Large diffs are not rendered by default.

0 comments on commit 7d8e1ae

Please sign in to comment.