Files
old-holivud2/app/models/contract_template_preview.rb
2020-05-31 22:38:19 +02:00

30 lines
867 B
Ruby

# frozen_string_literal: true
class ContractTemplatePreview
def initialize(contract_template)
@contract_template = contract_template
end
def build_releasable
template_release_type = @contract_template.release_type
fill_ct_empty_fields_with_dummy_data
releasable = "#{template_release_type}_release".classify.safe_constantize.new
releasable.fill_with_dummy_data(@contract_template)
releasable
end
private
def fill_ct_empty_fields_with_dummy_data
if @contract_template.name.blank?
@contract_template.name = 'Contract Template Name'
end
if @contract_template.body.blank?
@contract_template.body = 'Contract Template Body text goes here'
end
if @contract_template.guardian_clause.blank?
@contract_template.guardian_clause = 'Contract Template Guardian Clause text goes here'
end
end
end