Class: Panda::Core::Admin::FormErrorComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/form_error_component.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, **attrs) ⇒ FormErrorComponent

Returns a new instance of FormErrorComponent.



7
8
9
10
# File 'app/components/panda/core/admin/form_error_component.rb', line 7

def initialize(model:, **attrs)
  @model = model
  super(**attrs)
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



12
13
14
# File 'app/components/panda/core/admin/form_error_component.rb', line 12

def model
  @model
end

Instance Method Details

#default_attrsObject



14
15
16
17
18
# File 'app/components/panda/core/admin/form_error_component.rb', line 14

def default_attrs
  {
    class: "mb-4 p-4 bg-red-50 border border-red-200 rounded-md"
  }
end

#render?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/components/panda/core/admin/form_error_component.rb', line 20

def render?
  error_messages.any?
end