Class: Decidim::Verifications::IdDocuments::InformationForm
Overview
A form object to be used as the base for identity document verification
Constant Summary
collapse
- DOCUMENT_TYPES =
%w(DNI NIE passport).freeze
Instance Method Summary
collapse
#form_attributes, handler_for, handler_name, #metadata, #to_partial_path, #unique_id, #verification_attachment
Instance Method Details
#document_types_for_select ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 39
def document_types_for_select
DOCUMENT_TYPES.map do |type|
[
I18n.t(type.downcase, scope: "decidim.verifications.id_documents"),
type
]
end
end
|
#handler_name ⇒ Object
23
24
25
|
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 23
def handler_name
"id_documents"
end
|
#map_model(model) ⇒ Object
27
28
29
30
|
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 27
def map_model(model)
self.document_type = model.verification_metadata["document_type"]
self.document_number = model.verification_metadata["document_number"]
end
|
32
33
34
35
36
37
|
# File 'app/forms/decidim/verifications/id_documents/information_form.rb', line 32
def verification_metadata
{
"document_type" => document_type,
"document_number" => document_number
}
end
|