Sha256: b12d30770faa9ef2b69968807fe8f4372cfd671a891f490f9071e964f3aa735c

Contents?: true

Size: 540 Bytes

Versions: 25

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

25 entries across 25 versions & 1 rubygems

Version Path
coveragebook_components-0.19.8 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.7 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.6 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.5 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.4 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.3 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.2 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.1 app/helpers/coco/modal_helper.rb
coveragebook_components-0.19.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.18.8 app/helpers/coco/modal_helper.rb
coveragebook_components-0.18.7 app/helpers/coco/modal_helper.rb
coveragebook_components-0.18.0 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.7 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.6 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.5 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.4 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.3 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.2 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.1 app/helpers/coco/modal_helper.rb
coveragebook_components-0.17.0 app/helpers/coco/modal_helper.rb