Class: FoxTail::BadgeComponent
Instance Attribute Summary
#html_attributes
Instance Method Summary
collapse
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
36
37
38
39
40
41
|
# File 'app/components/fox_tail/badge_component.rb', line 36
def before_render
super
html_attributes[:href] = url if url?
html_attributes[:class] = classnames theme.apply(:root, self), html_class
end
|
#call ⇒ Object
43
44
45
46
47
48
49
|
# File 'app/components/fox_tail/badge_component.rb', line 43
def call
content_tag tag_name, html_attributes do
concat icon if icon?
concat content_tag(:span, content, class: theme.apply(:content, self)) if content?
concat dismiss_icon if dismiss_icon?
end
end
|
#tag_name ⇒ Object
32
33
34
|
# File 'app/components/fox_tail/badge_component.rb', line 32
def tag_name
url? ? :a : :span
end
|