Class: TinyAdmin::Views::Components::Flash
- Inherits:
-
BasicComponent
- Object
- Phlex::HTML
- BasicComponent
- TinyAdmin::Views::Components::Flash
- Defined in:
- lib/tiny_admin/views/components/flash.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
Methods inherited from BasicComponent
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
7 8 9 |
# File 'lib/tiny_admin/views/components/flash.rb', line 7 def @messages end |
Instance Method Details
#view_template ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tiny_admin/views/components/flash.rb', line 9 def view_template @messages ||= {} notices = [:notices] warnings = [:warnings] errors = [:errors] div(class: 'flash') { div(class: 'notices alert alert-success', role: 'alert') { notices.join(', ') } if notices&.any? div(class: 'notices alert alert-warning', role: 'alert') { warnings.join(', ') } if warnings&.any? div(class: 'notices alert alert-danger', role: 'alert') { errors.join(', ') } if errors&.any? } end |