class Bootstrap4RailsComponents::Bootstrap::Components::Modal

Bootstrap Modal Component getbootstrap.com/docs/4.1/components/modal/

Public Instance Methods

component_family() click to toggle source

NOTE: ARIALABELLEDBY has not been introduced on speed modals. ex: aria-labelledby=“exampleModalLabel” which is then the ID of the modal title element

# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 14
def component_family
  :modal
end
render() { |: body)| ... } click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 26
def render
  super do
    content_tag(:div, class: 'modal-dialog', role: 'document') do
      content_tag(:div, class: 'modal-content') do
        capture do
          concat(Bootstrap4RailsComponents::Bootstrap::Components::ModalHeader.new({ title: title }, view_context).render)
          if render_in_body
            concat(Bootstrap4RailsComponents::Bootstrap::Components::ModalBody.new({ body: (block_given? ? yield : body) }, view_context).render)
          else
            concat(block_given? ? yield : body)
          end
          if footer
            concat(Bootstrap4RailsComponents::Bootstrap::Components::ModalFooter.new({ body: footer }, view_context).render)
          end
        end
      end
    end
  end
end
render_in_body() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 46
def render_in_body
  options.fetch(:render_in_body, true)
end
title() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 18
def title
  options.fetch(:title, nil)
end

Private Instance Methods

assistive_html_attributes() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 60
def assistive_html_attributes
  super.merge(role: 'dialog', tabindex: '-1', aria: { hidden: 'true' })
end
css_classes() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 52
def css_classes
  super + ' fade'
end
non_html_attribute_options() click to toggle source
# File lib/bootstrap4_rails_components/bootstrap/components/modal.rb, line 56
def non_html_attribute_options
  super.push((:footer if footer.present?), (:title if title.present?))
end