Class: Decidim::Admin::ShareTokenForm
- Inherits:
-
Form
show all
- Defined in:
- decidim-admin/app/forms/decidim/admin/share_token_form.rb
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, 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
#expires_at ⇒ Object
28
29
30
31
32
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 28
def expires_at
return nil if no_expiration.present?
super
end
|
#map_model(model) ⇒ Object
20
21
22
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 20
def map_model(model)
self.no_expiration = model.expires_at.blank?
end
|
#organization ⇒ Object
38
39
40
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 38
def organization
context[:current_organization]
end
|
#token ⇒ Object
24
25
26
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 24
def token
super.strip.upcase.gsub(/\s+/, "-") if super.present?
end
|
#token_for ⇒ Object
34
35
36
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 34
def token_for
context[:resource]
end
|
#user ⇒ Object
42
43
44
|
# File 'decidim-admin/app/forms/decidim/admin/share_token_form.rb', line 42
def user
context[:current_user]
end
|