Module: Coco::AppHelper
- Included in:
- 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, ComponentHelper, Concerns::ActsAsButtonGroup, Concerns::ActsAsFieldWithOptions
- Defined in:
- app/helpers/coco/app_helper.rb
Instance Method Summary collapse
- #coco_app_header(&block) ⇒ Object
- #coco_color_picker_button(&block) ⇒ Object
- #coco_confirm_button(href = nil, &block) ⇒ Object
- #coco_contact_callout(&block) ⇒ Object
- #coco_dropdown_button(&block) ⇒ Object
- #coco_faqs(&block) ⇒ Object
- #coco_fields(&block) ⇒ Object
- #coco_form_for(&block) ⇒ Object
- #coco_form_with(&block) ⇒ Object
- #coco_image_picker_button(&block) ⇒ Object
- #coco_layout(name, &block) ⇒ Object
- #coco_layout_picker_button(&block) ⇒ Object
- #coco_link(*args, &block) ⇒ Object
- #coco_menu_button(&block) ⇒ Object
- #coco_menu_item(type, &block) ⇒ Object
- #coco_notice(&block) ⇒ Object
- #coco_option_bar(&block) ⇒ Object
- #coco_page(id, &block) ⇒ Object
- #coco_panel(&block) ⇒ Object
- #coco_plan_card(&block) ⇒ Object
- #coco_plan_picker(&block) ⇒ Object
- #coco_seamless_textarea(&block) ⇒ Object
- #coco_sidebar_nav(&block) ⇒ Object
- #coco_sidebar_nav_menu(&block) ⇒ Object
- #coco_snackbar(&block) ⇒ Object
- #coco_stamp(type = nil) ⇒ Object
- #coco_system_banner(&block) ⇒ Object
- #coco_toast(&block) ⇒ Object
- #coco_toolbar(&block) ⇒ Object
Instance Method Details
#coco_app_header(&block) ⇒ Object
121 122 123 |
# File 'app/helpers/coco/app_helper.rb', line 121 def coco_app_header(*, **, &block) render Coco::App::Blocks::Header.new(*, **), &block end |
#coco_color_picker_button(&block) ⇒ Object
24 25 26 |
# File 'app/helpers/coco/app_helper.rb', line 24 def (**, &block) render Coco::App::Elements::ColorPickerButton.new(**), &block end |
#coco_confirm_button(href = nil, &block) ⇒ Object
20 21 22 |
# File 'app/helpers/coco/app_helper.rb', line 20 def (href = nil, **, &block) render Coco::App::Elements::ConfirmButton.new(href: href, **), &block end |
#coco_contact_callout(&block) ⇒ Object
113 114 115 |
# File 'app/helpers/coco/app_helper.rb', line 113 def coco_contact_callout(**, &block) render Coco::App::Blocks::ContactCallout.new(**), &block end |
#coco_dropdown_button(&block) ⇒ Object
36 37 38 |
# File 'app/helpers/coco/app_helper.rb', line 36 def (**, &block) render Coco::App::Elements::DropdownButton.new(**), &block end |
#coco_faqs(&block) ⇒ Object
109 110 111 |
# File 'app/helpers/coco/app_helper.rb', line 109 def coco_faqs(**, &block) render Coco::App::Blocks::Faqs.new(**), &block end |
#coco_fields(&block) ⇒ Object
101 102 103 |
# File 'app/helpers/coco/app_helper.rb', line 101 def coco_fields(**, &block) fields(**, builder: Coco::AppFormBuilder, &block) end |
#coco_form_for(&block) ⇒ Object
97 98 99 |
# File 'app/helpers/coco/app_helper.rb', line 97 def coco_form_for(*, **, &block) form_for(*, **, builder: Coco::AppFormBuilder, &block) end |
#coco_form_with(&block) ⇒ Object
93 94 95 |
# File 'app/helpers/coco/app_helper.rb', line 93 def coco_form_with(**, &block) form_with(**, builder: Coco::AppFormBuilder, &block) end |
#coco_image_picker_button(&block) ⇒ Object
28 29 30 |
# File 'app/helpers/coco/app_helper.rb', line 28 def (**, &block) render Coco::App::Elements::ImagePickerButton.new(**), &block end |
#coco_layout(name, &block) ⇒ Object
105 106 107 |
# File 'app/helpers/coco/app_helper.rb', line 105 def coco_layout(name, **, &block) render coco_component("app/layouts/#{name}", **), &block end |
#coco_layout_picker_button(&block) ⇒ Object
32 33 34 |
# File 'app/helpers/coco/app_helper.rb', line 32 def (**, &block) render Coco::App::Elements::LayoutPickerButton.new(**), &block end |
#coco_link(*args, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/coco/app_helper.rb', line 3 def coco_link(*args, **, &block) href, content = if block [args.first, nil] else (args.size == 1) ? [nil, args.first] : args[0..2].reverse! end link = Coco::Link.new(href: href, **) link = link.with_content(content) if !block && content.present? render(link, &block) end |
#coco_menu_button(&block) ⇒ Object
16 17 18 |
# File 'app/helpers/coco/app_helper.rb', line 16 def (**, &block) render Coco::App::Elements::MenuButton.new(**), &block end |
#coco_menu_item(type, &block) ⇒ Object
133 134 135 |
# File 'app/helpers/coco/app_helper.rb', line 133 def (type, **, &block) render coco_component("app/elements/menu_items/#{type}", **), &block end |
#coco_notice(&block) ⇒ Object
73 74 75 |
# File 'app/helpers/coco/app_helper.rb', line 73 def coco_notice(**, &block) render Coco::App::Elements::Notice.new(**), &block end |
#coco_option_bar(&block) ⇒ Object
44 45 46 |
# File 'app/helpers/coco/app_helper.rb', line 44 def (**, &block) render Coco::App::Elements::OptionBar.new(**), &block end |
#coco_page(id, &block) ⇒ Object
137 138 139 |
# File 'app/helpers/coco/app_helper.rb', line 137 def coco_page(id, **, &block) render coco_component("app/layouts/page", id: id, **), &block end |
#coco_panel(&block) ⇒ Object
89 90 91 |
# File 'app/helpers/coco/app_helper.rb', line 89 def coco_panel(**, &block) render Coco::Panel.new(**), &block end |
#coco_plan_card(&block) ⇒ Object
85 86 87 |
# File 'app/helpers/coco/app_helper.rb', line 85 def coco_plan_card(**, &block) render Coco::App::Elements::PlanCard.new(**), &block end |
#coco_plan_picker(&block) ⇒ Object
117 118 119 |
# File 'app/helpers/coco/app_helper.rb', line 117 def coco_plan_picker(**, &block) render Coco::App::Blocks::PlanPicker.new(**), &block end |
#coco_seamless_textarea(&block) ⇒ Object
48 49 50 |
# File 'app/helpers/coco/app_helper.rb', line 48 def coco_seamless_textarea(**, &block) render Coco::App::Elements::SeamlessTextarea.new(**), &block end |
#coco_sidebar_nav(&block) ⇒ Object
125 126 127 |
# File 'app/helpers/coco/app_helper.rb', line 125 def (*, **, &block) render Coco::App::Blocks::SidebarNav::Navbar.new(*, **), &block end |
#coco_sidebar_nav_menu(&block) ⇒ Object
129 130 131 |
# File 'app/helpers/coco/app_helper.rb', line 129 def (*, **, &block) render Coco::App::Blocks::SidebarNav::Menu.new(*, **), &block end |
#coco_snackbar(&block) ⇒ Object
69 70 71 |
# File 'app/helpers/coco/app_helper.rb', line 69 def (**, &block) render Coco::App::Elements::Snackbar.new(**), &block end |
#coco_stamp(type = nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/helpers/coco/app_helper.rb', line 52 def coco_stamp(type = nil, **) props = case type when :success, :positive {icon: :check_circle, theme: :positive} when :error, :negative {icon: :alert_circle, theme: :negative} when :warning {icon: :alert_triangle, theme: :warning} when :info {icon: :info, theme: :info} else {} end render Coco::App::Elements::Stamp.new(**props, **) end |
#coco_system_banner(&block) ⇒ Object
81 82 83 |
# File 'app/helpers/coco/app_helper.rb', line 81 def (**, &block) render Coco::App::Elements::SystemBanner.new(**), &block end |