Class: FoxTail::ButtonComponent
Instance Attribute Summary
#html_attributes
Instance Method Summary
collapse
#link?, #root_tag_name, stimulus_controller_name, #stimulus_controller_options, #use_stimulus?
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
50
51
52
53
54
|
# File 'app/components/fox_tail/button_component.rb', line 50
def before_render
super
with_loading_icon if !loading_icon? && loadable?
end
|
#call ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'app/components/fox_tail/button_component.rb', line 56
def call
super do
concat indicator if indicator?
concat loading_icon if loading_icon?
concat left_visual if left_visual?
if loadable? && loading_label?
if controlled?
concat(
content_tag(
:span,
loading_label,
class: !loading? && theme.classname("hidden"),
data: {stimulus_controller.target_key => "loading"}
)
)
concat(
content_tag(
:span,
content,
class: loading? && theme.classname("hidden"),
data: {stimulus_controller.target_key => "active"}
)
)
else
concat loading_label
end
else
concat retrieve_content
end
concat right_visual if right_visual?
end
end
|
#loadable? ⇒ Boolean
42
43
44
|
# File 'app/components/fox_tail/button_component.rb', line 42
def loadable?
loading? || super
end
|
#visuals? ⇒ Boolean
46
47
48
|
# File 'app/components/fox_tail/button_component.rb', line 46
def visuals?
loadable? || left_visual? || right_visual?
end
|