Module: Coco::Concerns::ActsAsButtonGroup
Constant Summary
collapse
- BUTTON_TYPES =
{
menu: "Coco::App::Elements::MenuButton",
color_picker: "Coco::App::Elements::ColorPickerButton",
layout_picker: "Coco::App::Elements::LayoutPickerButton",
image_picker: "Coco::App::Elements::ImagePickerButton",
dropdown: "Coco::App::Elements::DropdownButton"
}
Instance Method Summary
collapse
Methods included from AppHelper
#coco_app_header, #coco_button, #coco_button_group, #coco_color_picker_button, #coco_confirm_button, #coco_dropdown_button, #coco_fields, #coco_form_for, #coco_form_with, #coco_image_picker_button, #coco_layout, #coco_layout_picker_button, #coco_link, #coco_menu_button, #coco_menu_item, #coco_notice, #coco_seamless_textarea, #coco_sidebar_nav, #coco_snackbar, #coco_system_banner, #coco_toast, #coco_toolbar
Instance Method Details
39
40
41
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 39
def init_button_group
with_item_noop
end
|
28
29
30
31
32
33
34
35
36
37
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 28
def instantiate_button(type, *args, **kwargs, &block)
href, content = if block
[args.first, nil]
else
(args.size == 1) ? [nil, args.first] : args[0..2].reverse!
end
component = BUTTON_TYPES[type].constantize.new(href: href, **button_kwargs(kwargs, type))
component.with_content(content) if !block && content.present?
component
end
|
47
48
49
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 47
def with_button(...)
with_item_button(...)
end
|
55
56
57
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 55
def with_color_picker_button(...)
with_item_color_picker_button(...)
end
|
#with_divider ⇒ Object
43
44
45
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 43
def with_divider(...)
with_item_divider(...)
end
|
67
68
69
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 67
def with_dropdown_button(...)
with_item_dropdown_button(...)
end
|
59
60
61
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 59
def with_image_picker_button(...)
with_item_image_picker_button(...)
end
|
63
64
65
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 63
def with_layout_picker_button(...)
with_item_layout_picker_button(...)
end
|
51
52
53
|
# File 'app/components/coco/concerns/acts_as_button_group.rb', line 51
def (...)
(...)
end
|