Class: UiBibz::Ui::Core::Bar

Inherits:
Component show all
Defined in:
lib/ui_bibz/ui/core/progress_bar/components/bar.rb

Overview

Create a NavLink

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 - State of élement with symbol value: (:default, :primary, :info, :warning, :danger)

  • label - String (default: “percentage%”)

  • percentage_min - Integer (default: 0)

  • percentage_max - Integer (default: 100)

  • sr_only - Boolean to show label (default: false)

  • type (:striped, :animated)

Signatures

UiBibz::Ui::Core::Bar.new(percentage, options = nil, html_options = nil)

UiBibz::Ui::Core::Bar.new(options = nil, html_options = nil) do
  percentage
end

Examples

UiBibz::Ui::Core::Bar.new(10)
# or
UiBibz::Ui::Core::Bar.new(10, { state: :success, sr_only: true, label: 'Loading...' },{ class: 'test' }).render
# or
UiBibz::Ui::Core::Bar.new({ state: :primary }) do
  40
end.render

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

#add_classes, #badge_html, #class_and_html_options, #glyph, #glyph_and_content_html, #glyph_with_space

Methods inherited from Base

#i18n_set?

Constructor Details

- (Bar) initialize(content = nil, options = nil, html_options = nil, &block)

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



47
48
49
# File 'lib/ui_bibz/ui/core/progress_bar/components/bar.rb', line 47

def initialize content = nil, options = nil, html_options = nil, &block
  super
end

Instance Method Details

- (Object) render

Render html tag



52
53
54
# File 'lib/ui_bibz/ui/core/progress_bar/components/bar.rb', line 52

def render
   :div, progressbar_inner_html, class_and_html_options(['progress-bar', type]).merge(bar_html_options)
end