Class: UiBibz::Ui::Core::Lists::Components::List

Inherits:
Component
  • Object
show all
Includes:
UiBibz::Ui::Concerns::HtmlConcern
Defined in:
lib/ui_bibz/ui/core/lists/components/list.rb

Overview

Create a list

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:

  • state - status of element with symbol value: (:active, :disabled)

  • url

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

  • glyph - Add glyph with name or hash options

    • name - String

    • size - Integer

    • tag - Symbol (:a, :button, :li)

Signatures

UiBibz::Ui::Core::Lists::Components::List.new do |l|
  l.header content =  nil, options = nil, html_options = nil, &block
  l.body content =  nil, options = nil, html_options = nil, &block
end

UiBibz::Ui::Core::Lists::Components::List.new content, options = nil, html_options = nil

UiBibz::Ui::Core::Lists::Components::List.new options = nil, html_options = nil do
  content
end

Examples

UiBibz::Ui::Core::Lists::Components::List.new('Test', status: :success, url: '#test').render

UiBibz::Ui::Core::Lists::Components::List.new(status: :primary) do
    'Test 2'
end.render

UiBibz::Ui::Core::List.new(state: :active) do |l|
  l.header 'My title', nil, class: 'my-title'
  l.body do
    'My content'
  end
end.render

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

#initialize, #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

This class inherits a constructor from UiBibz::Ui::Core::Component

Instance Method Details

#body(content = nil, options = nil, html_options = nil, &block) ⇒ Object

Add body which is a component



79
80
81
# File 'lib/ui_bibz/ui/core/lists/components/list.rb', line 79

def body(content = nil, options = nil, html_options = nil, &block)
  @body = UiBibz::Ui::Core::Lists::Components::ListBody.new content, options, html_options, &block
end

#header(content = nil, options = nil, html_options = nil, &block) ⇒ Object

Add header which is a component



74
75
76
# File 'lib/ui_bibz/ui/core/lists/components/list.rb', line 74

def header(content = nil, options = nil, html_options = nil, &block)
  @header = UiBibz::Ui::Core::Lists::Components::ListHeader.new content, options, html_options, &block
end

#pre_renderObject

Render html tag



64
65
66
67
68
69
70
71
# File 'lib/ui_bibz/ui/core/lists/components/list.rb', line 64

def pre_render
   tag_type, html_options do
    concat glyph_and_content_html if @content
    concat header_html if @header
    concat body_html   if @body
    concat badge_html  if @options[:badge]
  end
end