Sha256: 9c0459227c4f743f9f22d1ba28233eccfd863df2427ff872327f6288d63cea71

Contents?: true

Size: 526 Bytes

Versions: 35

Compression:

Stored size: 526 Bytes

Contents

module Coco
  class ModalDialog < Coco::Component
    include Concerns::AcceptsOptions

    accepts_option :dismissable, from: [true, false], default: true

    renders_one :title

    before_render do
      unless title?
        raise ArgumentError, "A title is required for modal dialogs"
      end
    end

    def initialize(**kwargs)
      title { kwargs[:title] } if kwargs[:title]
    end

    def header?
      title || dismissable?
    end

    def dismissable?
      get_option_value(:dismissable)
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
coveragebook_components-0.8.0 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.8.0.beta.3 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.8.0.beta.2 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.8.0.beta.1 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.10 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.9 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.8 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.7 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.6 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.5 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.4 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.3 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.2 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.1 app/components/coco/base/modal_dialog/modal_dialog.rb
coveragebook_components-0.7.0 app/components/coco/base/modal_dialog/modal_dialog.rb