Class: Decidim::Verifications::IdDocuments::Admin::ConfigForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
decidim-verifications/app/forms/decidim/verifications/id_documents/admin/config_form.rb

Instance Method Summary collapse

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#has_some_method_selected?Boolean

Returns:

  • (Boolean)

25
26
27
28
29
30
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/admin/config_form.rb', line 25

def has_some_method_selected?
  return if online || offline

  errors.add(:online, :invalid)
  errors.add(:offline, :invalid)
end

#map_model(model) ⇒ Object


19
20
21
22
23
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/admin/config_form.rb', line 19

def map_model(model)
  self.online = model.id_documents_methods.include?("online")
  self.offline = model.id_documents_methods.include?("offline")
  self.offline_explanation = model.id_documents_explanation_text
end

#selected_methodsObject


32
33
34
35
36
37
# File 'decidim-verifications/app/forms/decidim/verifications/id_documents/admin/config_form.rb', line 32

def selected_methods
  methods = []
  methods << "offline" if offline
  methods << "online" if online
  methods
end