Module: Coco::AppHelper
- Included in:
- Coco::App::Blocks::NavBar, Coco::App::Blocks::NavDrawer, Coco::App::Blocks::SlideEditor, Coco::App::Elements::ColorPicker, Coco::App::Elements::ColorPickerButton, Coco::App::Elements::ImagePicker, Coco::App::Elements::ImagePickerButton, Coco::App::Elements::LayoutPickerButton, Coco::App::Elements::MenuButton, Coco::App::Elements::Toolbar, Coco::App::Fields::ButtonComponent, ComponentHelper, Concerns::ActsAsButtonGroup, Concerns::ActsAsFieldWithOptions
- Defined in:
- app/helpers/coco/app_helper.rb
Instance Method Summary collapse
- #coco_button(href = nil, **kwargs, &block) ⇒ Object
- #coco_button_group(**kwargs, &block) ⇒ Object
- #coco_color_picker_button(**kwargs, &block) ⇒ Object
- #coco_confirm_button(href = nil, **kwargs, &block) ⇒ Object
- #coco_dropdown_button(**kwargs, &block) ⇒ Object
- #coco_fields(**kwargs, &block) ⇒ Object
- #coco_form_button(**kwargs, &block) ⇒ Object
- #coco_form_for(*args, **kwargs, &block) ⇒ Object
- #coco_form_with(**kwargs, &block) ⇒ Object
- #coco_image_picker_button(**kwargs, &block) ⇒ Object
- #coco_layout_picker_button(**kwargs, &block) ⇒ Object
- #coco_link(*args, **kwargs, &block) ⇒ Object
- #coco_menu_button(**kwargs, &block) ⇒ Object
- #coco_notice(**kwargs, &block) ⇒ Object
- #coco_seamless_textarea(**kwargs, &block) ⇒ Object
- #coco_snackbar(**kwargs, &block) ⇒ Object
- #coco_system_banner(**kwargs, &block) ⇒ Object
- #coco_toast(**kwargs, &block) ⇒ Object
- #coco_toolbar(**kwargs, &block) ⇒ Object
Instance Method Details
#coco_button(href = nil, **kwargs, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/coco/app_helper.rb', line 11 def (href = nil, **kwargs, &block) = if kwargs.key?(:action) || kwargs.key?(:method) || kwargs.key?(:params) "FormButton" else "Button" end component = "Coco::App::Elements::#{}".constantize.new(href: href, **kwargs) render component, &block end |
#coco_button_group(**kwargs, &block) ⇒ Object
50 51 52 |
# File 'app/helpers/coco/app_helper.rb', line 50 def (**kwargs, &block) render Coco::App::Elements::ButtonGroup.new(**kwargs), &block end |
#coco_color_picker_button(**kwargs, &block) ⇒ Object
34 35 36 |
# File 'app/helpers/coco/app_helper.rb', line 34 def (**kwargs, &block) render Coco::App::Elements::ColorPickerButton.new(**kwargs), &block end |
#coco_confirm_button(href = nil, **kwargs, &block) ⇒ Object
30 31 32 |
# File 'app/helpers/coco/app_helper.rb', line 30 def (href = nil, **kwargs, &block) render Coco::App::Elements::ConfirmButton.new(href: href, **kwargs), &block end |
#coco_dropdown_button(**kwargs, &block) ⇒ Object
46 47 48 |
# File 'app/helpers/coco/app_helper.rb', line 46 def (**kwargs, &block) render Coco::App::Elements::DropdownButton.new(**kwargs), &block end |
#coco_fields(**kwargs, &block) ⇒ Object
86 87 88 |
# File 'app/helpers/coco/app_helper.rb', line 86 def coco_fields(**kwargs, &block) fields(**kwargs, builder: Coco::AppFormBuilder, &block) end |
#coco_form_button(**kwargs, &block) ⇒ Object
22 23 24 |
# File 'app/helpers/coco/app_helper.rb', line 22 def (**kwargs, &block) render Coco::App::Elements::FormButton.new(**kwargs), &block end |
#coco_form_for(*args, **kwargs, &block) ⇒ Object
82 83 84 |
# File 'app/helpers/coco/app_helper.rb', line 82 def coco_form_for(*args, **kwargs, &block) form_for(*args, **kwargs, builder: Coco::AppFormBuilder, &block) end |
#coco_form_with(**kwargs, &block) ⇒ Object
78 79 80 |
# File 'app/helpers/coco/app_helper.rb', line 78 def coco_form_with(**kwargs, &block) form_with(**kwargs, builder: Coco::AppFormBuilder, &block) end |
#coco_image_picker_button(**kwargs, &block) ⇒ Object
38 39 40 |
# File 'app/helpers/coco/app_helper.rb', line 38 def (**kwargs, &block) render Coco::App::Elements::ImagePickerButton.new(**kwargs), &block end |
#coco_layout_picker_button(**kwargs, &block) ⇒ Object
42 43 44 |
# File 'app/helpers/coco/app_helper.rb', line 42 def (**kwargs, &block) render Coco::App::Elements::LayoutPickerButton.new(**kwargs), &block end |
#coco_link(*args, **kwargs, &block) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/coco/app_helper.rb', line 3 def coco_link(*args, **kwargs, &block) href, content = args[0..2].reverse! link = Coco::App::Elements::Link.new(href: href, **kwargs) link = link.with_content(content) unless block render(link, &block) end |
#coco_menu_button(**kwargs, &block) ⇒ Object
26 27 28 |
# File 'app/helpers/coco/app_helper.rb', line 26 def (**kwargs, &block) render Coco::App::Elements::MenuButton.new(**kwargs), &block end |
#coco_notice(**kwargs, &block) ⇒ Object
66 67 68 |
# File 'app/helpers/coco/app_helper.rb', line 66 def coco_notice(**kwargs, &block) render Coco::App::Elements::Notice.new(**kwargs), &block end |
#coco_seamless_textarea(**kwargs, &block) ⇒ Object
58 59 60 |
# File 'app/helpers/coco/app_helper.rb', line 58 def coco_seamless_textarea(**kwargs, &block) render Coco::App::Elements::SeamlessTextarea.new(**kwargs), &block end |
#coco_snackbar(**kwargs, &block) ⇒ Object
62 63 64 |
# File 'app/helpers/coco/app_helper.rb', line 62 def (**kwargs, &block) render Coco::App::Elements::Snackbar.new(**kwargs), &block end |
#coco_system_banner(**kwargs, &block) ⇒ Object
74 75 76 |
# File 'app/helpers/coco/app_helper.rb', line 74 def (**kwargs, &block) render Coco::App::Elements::SystemBanner.new(**kwargs), &block end |