Class: UiBibz::Ui::Core::Boxes::Card

Inherits:
Component show all
Includes:
UiBibz::Ui::Concerns::CardItemableConcern
Defined in:
lib/ui_bibz/ui/core/boxes/card.rb

Overview

Create a card

This element is an extend of UiBibz::Ui::Core::Component.

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:

  • status - status of element with symbol value: (:primary, :secondary, :info, :warning, :danger)

  • text - Hash (:size, :position) (:left, :right, :center)

  • block - Boolean

  • tabbed - Boolean to use tab card

  • type - Symbol (:inverse)

Signatures

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

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

UiBibz::Ui::Core::Boxes::Card.new(options = nil, html_options = nil).tap do |p|
  p.header content = nil, options = nil, html_options = nil, &block
  p.block content = nil, options = nil, html_options = nil, &block
  p.footer content = nil, options = nil, html_options = nil, &block
end

Examples

UiBibz::Ui::Core::Boxes::Card('test').render

UiBibz::Ui::Core::Boxes::Card(status: :primary) do |d|
  'test'
end.render

UiBibz::Ui::Core::Boxes::Card.new().tap do |p|
  p.header 'header', glyph: 'eye', class: 'header-test'
  p.block do
    'body'
  end
  p.footer 'footer'
end.render

Helper

card(content, options = {}, html_options = {})

card(options = {}, html_options = {}) do
  content
end

card(options = {}, html_options = {}) do |p|
  p.header(content, options = {}, html_options = {})
  # or
  p.header(options = {}, html_options = {}) do
    content
  end

  p.body(content, options = {}, html_options = {})
  # or
  p.body(options = {}, html_options = {}) do
    content
  end

  p.footer(content, options = {}, html_options = {})
  # or
  p.footer(options = {}, html_options = {}) do
    content
  end
end

Direct Known Subclasses

Ux::Tables::TableCard

Constant Summary

Constants inherited from Component

Component::BREAKPOINTS, Component::SIZES, Component::STATUSES

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Component

#render, #tapped?

Methods included from PopoverExtension

#popover_data_html, #tooltip_data_html

Methods included from GlyphExtension

#generate_glyph, #glyph_and_content_html

Methods included from KlassExtension

#exclude_classes, #exclude_classes_in_html_options, #join_classes

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Card

Use link_to system in rails

  • Content can be send by content variable or by block if a block is sent, variable ‘content’ does not exit.

  • Options of component is defined in hash options

  • Html options is defined in hash html_options



95
96
97
98
# File 'lib/ui_bibz/ui/core/boxes/card.rb', line 95

def initialize(content = nil, options = nil, html_options = nil, &block)
  super
  @items = @content.nil? ? [] : [UiBibz::Ui::Core::Boxes::Components::CardBody.new(@content).render]
end

Instance Method Details

#pre_renderObject

Render html tag



101
102
103
# File 'lib/ui_bibz/ui/core/boxes/card.rb', line 101

def pre_render
   :div, html_structure, html_options
end