Class: UI::FieldError
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::FieldError
- Includes:
- FieldErrorBehavior
- Defined in:
- app/components/ui/field_error.rb
Overview
Error - Phlex implementation
Error message display for form fields with accessibility support. Uses FieldErrorBehavior concern for shared styling logic.
Instance Method Summary collapse
-
#initialize(errors: nil, classes: "", **attributes) ⇒ FieldError
constructor
A new instance of FieldError.
- #view_template(&block) ⇒ Object
Methods included from FieldErrorBehavior
#error_message, #field_error_classes, #field_error_html_attributes, #has_errors?, #multiple_errors?, #single_error?
Constructor Details
#initialize(errors: nil, classes: "", **attributes) ⇒ FieldError
Returns a new instance of FieldError.
22 23 24 25 26 27 |
# File 'app/components/ui/field_error.rb', line 22 def initialize(errors: nil, classes: "", **attributes) @errors = errors @classes = classes @attributes = attributes @block_given = false end |
Instance Method Details
#view_template(&block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/ui/field_error.rb', line 29 def view_template(&block) @block_given = block_given? return unless has_errors? || @block_given if has_errors? render_errors else render_content(&block) end end |