Class: BulmaPhlex::Notification
- Inherits:
-
Base
- Object
- Base
- BulmaPhlex::Notification
- Defined in:
- lib/bulma_phlex/notification.rb
Overview
Renders a Bulma notification component.
A styled alert box for displaying messages to the user. Supports color and style mode (light/dark) options, and optionally includes a dismiss button whose HTML attributes can be customized. Content is provided via a block.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(delete: nil, color: nil, mode: nil, **html_attributes) ⇒ Notification
constructor
A new instance of Notification.
- #view_template ⇒ Object
Constructor Details
#initialize(delete: nil, color: nil, mode: nil, **html_attributes) ⇒ Notification
Returns a new instance of Notification.
21 22 23 24 25 26 27 28 |
# File 'lib/bulma_phlex/notification.rb', line 21 def initialize(delete: nil, color: nil, mode: nil, **html_attributes) @delete = delete @color = color @mode = mode @html_attributes = html_attributes after_initialize end |
Class Method Details
.new(delete: nil, color: nil, mode: nil, **html_attributes) ⇒ Object
Parameters
delete— Iftrue, includes a delete button to dismiss the notification. Can also be a hash of HTML attributes for the buttoncolor— Color of the notification (e.g."primary","info","danger")mode— Style mode:"light"or"dark"**html_attributes— Additional HTML attributes for the notification element
17 18 19 |
# File 'lib/bulma_phlex/notification.rb', line 17 def self.new(delete: nil, color: nil, mode: nil, **html_attributes) super end |
Instance Method Details
#view_template ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/bulma_phlex/notification.rb', line 30 def view_template(&) vanish(&) div(**mix({ class: notification_classes }, **@html_attributes)) do if @delete yield end end |