Class: Decidim::System::UpdateOrganizationForm
Overview
A form object used to update organizations from the system dashboard.
Constant Summary
collapse
- OMNIATH_PROVIDERS_ATTRIBUTES =
Decidim::OmniauthProvider.available.keys.map do |provider|
Rails.application.secrets.dig(:omniauth, provider).keys.map do |setting|
if setting == :enabled
["omniauth_settings_#{provider}_enabled".to_sym, Boolean]
else
["omniauth_settings_#{provider}_#{setting}".to_sym, String]
end
end
end.flatten(1)
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary collapse
#context
Instance Method Summary
collapse
#default_locale?
ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Attribute Details
#password ⇒ Object
72
73
74
|
# File 'decidim-system/app/forms/decidim/system/update_organization_form.rb', line 72
def password
Decidim::AttributeEncryptor.decrypt(encrypted_password) unless encrypted_password.nil?
end
|
Instance Method Details
#clean_available_authorizations ⇒ Object
66
67
68
69
70
|
# File 'decidim-system/app/forms/decidim/system/update_organization_form.rb', line 66
def clean_available_authorizations
return unless available_authorizations
available_authorizations.select(&:present?)
end
|
#clean_secondary_hosts ⇒ Object
60
61
62
63
64
|
# File 'decidim-system/app/forms/decidim/system/update_organization_form.rb', line 60
def clean_secondary_hosts
return unless secondary_hosts
secondary_hosts.split("\n").map(&:chomp).select(&:present?)
end
|
#encrypted_omniauth_settings ⇒ Object
#encrypted_smtp_settings ⇒ Object
76
77
78
79
80
|
# File 'decidim-system/app/forms/decidim/system/update_organization_form.rb', line 76
def encrypted_smtp_settings
smtp_settings["from"] = set_from
smtp_settings.merge(encrypted_password: Decidim::AttributeEncryptor.encrypt(@password))
end
|
#map_model(model) ⇒ Object
#set_from ⇒ Object
82
83
84
85
86
|
# File 'decidim-system/app/forms/decidim/system/update_organization_form.rb', line 82
def set_from
return from_email if from_label.blank?
"#{from_label} <#{from_email}>"
end
|