Class: UiBibz::Ui::Core::Boxes::Card
- 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, = nil, = nil)
UiBibz::Ui::Core::Boxes::Card.new( = nil, = nil) do
content
end
UiBibz::Ui::Core::Boxes::Card.new( = nil, = nil).tap do |p|
p.header content = nil, = nil, = nil, &block
p.block content = nil, = nil, = nil, &block
p. content = nil, = nil, = 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'
end.render
Helper
card(content, = {}, = {})
card( = {}, = {}) do
content
end
card( = {}, = {}) do |p|
p.header(content, = {}, = {})
# or
p.header( = {}, = {}) do
content
end
p.body(content, = {}, = {})
# or
p.body( = {}, = {}) do
content
end
p.(content, = {}, = {})
# or
p.( = {}, = {}) do
content
end
end
Direct Known Subclasses
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
Instance Method Summary collapse
-
#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Card
constructor
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.
-
#pre_render ⇒ Object
Render html tag.
Methods inherited from Component
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, = nil, = nil, &block) super @items = @content.nil? ? [] : [UiBibz::Ui::Core::Boxes::Components::CardBody.new(@content).render] end |
Instance Method Details
#pre_render ⇒ Object
Render html tag
101 102 103 |
# File 'lib/ui_bibz/ui/core/boxes/card.rb', line 101 def pre_render content_tag :div, html_structure, end |