app/components/coco/buttons/button/button.rb in coveragebook_components-0.17.5 vs app/components/coco/buttons/button/button.rb in coveragebook_components-0.17.6
- old
+ new
@@ -70,19 +70,21 @@
renders_many :states, ->(name = nil, **kwargs) do
name ||= kwargs.fetch(:name)
@states[name.to_sym] = kwargs.except!(:name)
end
- attr_reader :on_click, :resize
+ attr_reader :on_click, :resize, :turbo_frame
- def initialize(click: nil, resize: nil, states: nil, loading: false, active: false, static: nil, **kwargs)
+ def initialize(click: nil, resize: nil, states: nil, loading: false, active: false, static: nil, turbo: nil, turbo_frame: nil, **kwargs)
@on_click = click
@resize = resize.to_h
@states = states.to_h
@loading = loading
@static = static
@active = active
+ @turbo = turbo
+ @turbo_frame = turbo_frame
end
def with_dropdown(...)
with_dropdown_content(...)
end
@@ -182,9 +184,17 @@
end.compact.to_h
end
def alpine_data
{tooltips: state_tooltips} if state_tooltips.present?
+ end
+
+ def turbo_data_attr_value
+ if @turbo == false
+ "false"
+ elsif @turbo == true
+ "true"
+ end
end
private
def default_states