Sha256: 26e49d2cec9261f168164dec2830bcc1de45be3b25aa3dcdb797e371c8bd28b7

Contents?: true

Size: 1.42 KB

Versions: 46

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

module UiBibz::Ui::Core::Notifications::Components
  # Create a alert body
  #
  # ==== Attributes
  #
  # * +content+ - Content of element
  # * +options+ - Options of element
  # * +html_options+ - Html Options of element
  #
  # ==== Options
  #
  # You can add HTML attributes using the +html_options+.
  # You can pass arguments in options attribute:
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::Core::Notifications::AlertHeader.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::Notifications::AlertHeader.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::Notifications::AlertHeader.new.render
  #
  #   UiBibz::Ui::Core::Notifications::AlertHeader.new do
  #     'Exemple'
  #   end.render
  #
  class AlertHeader < UiBibz::Ui::Core::Component
    # See UiBibz::Ui::Core::Component.initialize

    def pre_render
      if options[:tap] == false
        html_content
      else
        content_tag :h4, html_content, html_options
      end
    end

    private

    def component_html_classes
      'alert-header'
    end

    def html_content
      output = [glyph_and_content_html]
      output << close_html if options[:closable]
      output.join.html_safe
    end

    def close_html
      content_tag :button, '', type: 'button', class: 'btn-close', 'data-bs-dismiss' => 'alert', 'aria-label' => 'Close'
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta18 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta17 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta16 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta15 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta14 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta13 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta10 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta9 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta8 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta7 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta6 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta4 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-4.0.0.beta3 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.13 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.12 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.11 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.10 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.9 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.8 lib/ui_bibz/ui/core/notifications/components/alert_header.rb
ui_bibz-3.0.7 lib/ui_bibz/ui/core/notifications/components/alert_header.rb