Class: Decidim::Admin::PermissionForm
- Inherits:
-
Form
show all
- Defined in:
- decidim-admin/app/forms/decidim/admin/permission_form.rb
Overview
This form handles permissions for a particular action in the admin panel.
Constant Summary
Decidim::AttributeObject::TypeMap::Boolean, Decidim::AttributeObject::TypeMap::Decimal
Instance Attribute Summary
#context
Instance Method Summary
collapse
ensure_hash, from_model, from_params, hash_from, infer_model_name, #map_model, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#authorization_handler_options(handler_name) ⇒ Object
20
21
22
|
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 20
def authorization_handler_options(handler_name)
authorization_handlers_options&.dig(handler_name.to_s) || {}
end
|
#authorization_handlers ⇒ Object
10
11
12
13
14
|
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 10
def authorization_handlers
handlers = super || []
handlers.index_with { |name| { "options" => authorization_handler_options(name) } }
end
|
#authorization_handlers_names ⇒ Object
16
17
18
|
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 16
def authorization_handlers_names
authorization_handlers.keys.map(&:to_s)
end
|
#manifest(handler_name) ⇒ Object
#options_attributes(handler_name) ⇒ Object
32
33
34
35
|
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 32
def options_attributes(handler_name)
manifest = options_manifest(handler_name)
manifest ? manifest.attributes : []
end
|
#options_schema(handler_name) ⇒ Object
28
29
30
|
# File 'decidim-admin/app/forms/decidim/admin/permission_form.rb', line 28
def options_schema(handler_name)
options_manifest(handler_name).schema.new(authorization_handler_options(handler_name))
end
|