Class: Decidim::Comments::CommentForm
- Inherits:
-
Form
- Object
- AttributeObject::Form
- Form
- Decidim::Comments::CommentForm
- Defined in:
- decidim-comments/app/forms/decidim/comments/comment_form.rb
Overview
A form object used to create comments from the graphql api.
Constant Summary
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from AttributeObject::Form
Instance Method Summary collapse
Methods inherited from AttributeObject::Form
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
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#max_depth ⇒ Object
31 32 33 34 35 |
# File 'decidim-comments/app/forms/decidim/comments/comment_form.rb', line 31 def max_depth return unless commentable.respond_to?(:depth) errors.add(:base, :invalid) if commentable.depth >= Comment::MAX_DEPTH end |
#max_length ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'decidim-comments/app/forms/decidim/comments/comment_form.rb', line 21 def max_length if current_component.try(:settings).respond_to?(:comments_max_length) component_length = current_component.try { settings.comments_max_length.positive? } return current_component.settings.comments_max_length if component_length end return current_organization.comments_max_length if current_organization.comments_max_length.positive? 1000 end |