Upstream sync

This commit is contained in:
Senad Uka
2020-07-27 10:17:56 +00:00
parent 8f13589c55
commit 9c3fac4ab9
37 changed files with 743 additions and 64 deletions

View File

@@ -0,0 +1,32 @@
module Amendmenable
extend ActiveSupport::Concern
included do
include ActiveStorageSupport::SupportForBase64
has_one_base64_attached :amendment_signature
with_options on: :amendment do
validates :amendment_signer_name, presence: true
validates :amendment_signature, attached: true
end
end
def amendment_signable?
contract_template.present? && contract_template.amendment_clause.present?
end
def amendment_signed?
amendment_signature.attached?
end
def amendment_signature_base64
nil
end
def amendment_signature_base64=(data_uri)
return if data_uri.blank?
amendment_signature.attach(data: data_uri, filename: "amendment_signature.png", content_type: "image/png", identify: "false")
end
end

View File

@@ -22,6 +22,7 @@ class ContractTemplate < ApplicationRecord
has_rich_text :body
has_rich_text :guardian_clause
has_rich_text :signature_legal_text
has_rich_text :amendment_clause
validates :name, presence: true
validates :release_type, presence: true

View File

@@ -12,6 +12,7 @@ class LocationRelease < ApplicationRecord
include PersonName
include CsvExportable
include Approvable
include Amendmenable
class << self
def custom_csv_exportable_headers