class UiBibz::Ui::Core::Boxes::Components::CardBody

Create a card body

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Boxes::CardBody.new(content, options = nil, html_options = nil)

UiBibz::Ui::Core::Boxes::CardBody.new(options = nil, html_options = nil) do
  content
end

Examples

UiBibz::Ui::Core::Boxes::CardBody.new.render

UiBibz::Ui::Core::Boxes::CardBody.new do
  'Exemple'
end.render

Public Class Methods

new(content = nil, options = nil, html_options = nil, &block) click to toggle source

See UiBibz::Ui::Core::Component.initialize

Calls superclass method UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 41
def initialize(content = nil, options = nil, html_options = nil, &block)
  super
  @items = [@content]
end

Public Instance Methods

pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 47
def pre_render
  if options[:collapse]
    content_tag :div, class: join_classes('collapse', show), id: options[:collapse], 'data-bs-parent': "##{options[:parent_collapse]}" do
      content_tag :div, @items.join.html_safe, html_options
    end
  else
    content_tag :div, @items.join.html_safe, html_options
  end
end
row(content = nil, options = nil, html_options = nil, &block) click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 73
def row(content = nil, options = nil, html_options = nil, &block)
  @items << if tapped?(block)
              UiBibz::Ui::Core::Layouts::Row.new(content, options, html_options).tap(&block).render
            else
              UiBibz::Ui::Core::Layouts::Row.new(content, options, html_options, &block).render
            end
end
subtitle(content = nil, options = nil, html_options = nil, &block) click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 61
def subtitle(content = nil, options = nil, html_options = nil, &block)
  @items << UiBibz::Ui::Core::Boxes::Components::Body::CardBodySubtitle.new(content, options, html_options, &block).render
end
text(content = nil, options = nil, html_options = nil, &block) click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 69
def text(content = nil, options = nil, html_options = nil, &block)
  @items << UiBibz::Ui::Core::Boxes::Components::Body::CardBodyText.new(content, options, html_options, &block).render
end
title(content = nil, options = nil, html_options = nil, &block) click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 57
def title(content = nil, options = nil, html_options = nil, &block)
  @items << UiBibz::Ui::Core::Boxes::Components::Body::CardBodyTitle.new(content, options, html_options, &block).render
end

Private Instance Methods

component_html_classes() click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 83
def component_html_classes
  ['card-body', outline, tab_pane]
end
component_html_options() click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 87
def component_html_options
  @options[:tab_pane].nil? ? {} : { id: @options[:tab_pane] }
end
outline() click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 91
def outline
  "text-#{@options[:status]}" if @options[:outline]
end
show() click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 95
def show
  'show' if @options[:show]
end
tab_pane() click to toggle source
# File lib/ui_bibz/ui/core/boxes/components/card_body.rb, line 99
def tab_pane
  'tab-pane' if options[:tab_pane]
end