fix MR comments
This commit is contained in:
@@ -14,26 +14,23 @@ class Public::AmendmentsController < Public::BaseController
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@release.amendment_signer_name = release_params[:amendment_signer_name]
|
@release.attributes = amendment_params
|
||||||
@release.amendment_signature_base64 = release_params[:amendment_signature_base64]
|
|
||||||
|
|
||||||
render :new unless @release.save
|
render :new unless @release.save(context: :amendment)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def release_params
|
def amendment_params
|
||||||
release_type = @contract_template.release_type
|
params.require(releasable_param.name).permit(:amendment_signer_name, :amendment_signature_base64)
|
||||||
param_name = "#{release_type}_release".to_s
|
end
|
||||||
params.require(param_name).permit(:amendment_signer_name, :amendment_signature_base64)
|
|
||||||
|
def releasable_param
|
||||||
|
@releasable_param ||= ReleasableParam.new(params.to_unsafe_h)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_release
|
def set_release
|
||||||
release_type = @contract_template.release_type
|
@release = @contract_template.releases.find(releasable_param.id)
|
||||||
param_name = "#{release_type}_release_id".to_s
|
|
||||||
release_id = params[param_name]
|
|
||||||
|
|
||||||
@release = @contract_template.releases.find(release_id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_contract_template
|
def set_contract_template
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ module Amendmenable
|
|||||||
include ActiveStorageSupport::SupportForBase64
|
include ActiveStorageSupport::SupportForBase64
|
||||||
|
|
||||||
has_one_base64_attached :amendment_signature
|
has_one_base64_attached :amendment_signature
|
||||||
|
|
||||||
|
with_options on: :amendment do
|
||||||
|
validates :amendment_signer_name, presence: true
|
||||||
|
validates :amendment_signature, attached: true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def amendment_signable?
|
def amendment_signable?
|
||||||
if contract_template.present?
|
contract_template.present? && contract_template.amendment_clause.present?
|
||||||
contract_template.amendment_clause.present?
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def amendment_signed?
|
def amendment_signed?
|
||||||
|
|||||||
Reference in New Issue
Block a user