Module: Coco::ModalHelper

Included in:
Button, Helpers, Link, Modal
Defined in:
app/helpers/coco/modal_helper.rb

Instance Method Summary collapse

Instance Method Details

Deprecated, do not use



16
17
18
19
20
# File 'app/helpers/coco/modal_helper.rb', line 16

def coco_link_to_modal(*, data: {}, modal: nil, **kwargs, &)
  kwargs[:data] = coco_modal_data_attributes(modal || "default").merge(data)

  coco_link_to(*, **kwargs, &)
end

#coco_modal_data_attributes(name = "default") ⇒ Object



7
8
9
10
11
12
13
# File 'app/helpers/coco/modal_helper.rb', line 7

def coco_modal_data_attributes(name = "default")
  return {} if name.nil?
  {
    turbo: true,
    turbo_frame: coco_modal_frame_id(name)
  }
end

#coco_modal_frame_id(name = "default") ⇒ Object



3
4
5
# File 'app/helpers/coco/modal_helper.rb', line 3

def coco_modal_frame_id(name = "default")
  "coco-modal-frame-#{name.to_s.dasherize}"
end