Sha256: b12d30770faa9ef2b69968807fe8f4372cfd671a891f490f9071e964f3aa735c

Contents?: true

Size: 540 Bytes

Versions: 27

Compression:

Stored size: 540 Bytes

Contents

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

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

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

      coco_link_to(*, **kwargs, &)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
coveragebook_components-0.17.1 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.16.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.15.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.14.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.13.1 app/helpers/coco/modal_helper.rb
coveragebook_components-0.13.0 app/helpers/coco/modal_helper.rb