Class: FoxTail::AlertComponent
Constant Summary
collapse
- SEVERITY_ICONS =
{success: "check-circle", warning: "exclamation-triangle", danger: "exclamation-circle"}.freeze
- DEFAULT_SEVERITY_ICON =
"information-circle"
Instance Attribute Summary
#html_attributes
Instance Method Summary
collapse
#call, stimulus_controller_name, #stimulus_controller_options
classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
fox_tail_config
Instance Method Details
#before_render ⇒ Object
83
84
85
86
87
88
89
90
|
# File 'app/components/fox_tail/alert_component.rb', line 83
def before_render
super
with_dismiss_icon unless !dismissible? || dismiss_icon
html_attributes[:class] = root_classes
html_attributes[:role] = :alert
end
|
#border ⇒ Object
69
70
71
72
73
74
75
76
77
|
# File 'app/components/fox_tail/alert_component.rb', line 69
def border
if options[:border].is_a?(TrueClass)
:basic
elsif !options[:border]
:none
else
(options[:border] || :none).to_sym
end
end
|
#border? ⇒ Boolean
65
66
67
|
# File 'app/components/fox_tail/alert_component.rb', line 65
def border?
border != :none
end
|
#use_stimulus? ⇒ Boolean
79
80
81
|
# File 'app/components/fox_tail/alert_component.rb', line 79
def use_stimulus?
super && dismissible?
end
|