Sha256: 1d5353f24d8b03ad46eb6142b6e24aee7d4625c9c478aca698e48cc6a5e8da4e
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
module Coco module BaseHelper def coco_tag(*, **, &block) render Coco::Tag.new(*, **), &block end def coco_svg(path = nil, **) render Coco::Svg.new(path: path, **) end def coco_image(src = nil, **) render Coco::Image.new(src: src, **) end def coco_icon(icon_name = nil, **, &block) render Coco::Icon.new(name: icon_name, **), &block end def coco_embed(platform, url = nil, **) case platform when :youtube render Coco::Embeds::Youtube.new(url: url, **) else raise ArgumentError, "`#{platform}` is not a valid embed type" end end def coco_placeholder(*, **, &block) render Coco::Placeholder.new(*, **), &block end def coco_modal(name = "default", **, &block) render(Coco::Modal.new(name: name, **), &block) end def coco_modal_dialog(name = "default", **, &block) render(Coco::Modal.new(name: name, **)) do |modal| modal.with_dialog(&block) end end def coco_link_to_modal(*, data: {}, modal: nil, **kwargs, &) kwargs[:data] = coco_modal_data_attributes(modal || "default").merge(data) coco_link_to(*, **kwargs, &) end def coco_modal_frame_id(name = "default") "coco-modal-frame-#{name.to_s.dasherize}" end def coco_modal_data_attributes(name = "default") { turbo: true, turbo_frame: coco_modal_frame_id(name) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
coveragebook_components-0.7.4 | app/helpers/coco/base_helper.rb |
coveragebook_components-0.7.3 | app/helpers/coco/base_helper.rb |
coveragebook_components-0.7.2 | app/helpers/coco/base_helper.rb |