Class: UiBibz::Ui::Core::ProgressBar
Overview
Create a progress bar
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%”)
-
tap - Boolean (true: To add several bars)
-
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::ProgressBar.new(percentage, = nil, = nil)
UiBibz::Ui::Core::ProgressBar.new( = nil, = nil) do
percentage
end
UiBibz::Ui::Core::ProgressBar.new(tap: true).tap do |pb|
pb. percentage, = nil, = nil
pb. = nil, = nil do
percentage
end
end
Examples
UiBibz::Ui::Core::ProgressBar.new(50)
# or
UiBibz::Ui::Core::ProgressBar.new(10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }).render
# or
UiBibz::Ui::Core::ProgressBar.new(tap: true).tap |pb|
pb.bar 10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }
pb.bar { state: :primary } do
20
end
end.render
Helper
(integer, = {}, = {})
( = { tap: true }, = {}) do |pb|
pb.(integer, = {}, = {})
pb.( = {}, = {}) do
integer
end
end
Instance Attribute Summary
Attributes inherited from Component
Attributes inherited from Base
Instance Method Summary (collapse)
-
- (Object) bar(content = nil, options = nil, html_options = nil, &block)
Add progressbar bar items See UiBibz::Ui::Core::Bar.
-
- (ProgressBar) initialize(content = nil, options = nil, html_options = nil, &block)
constructor
See UiBibz::Ui::Core::Component.initialize.
-
- (Object) render
Render html tag.
Methods inherited from Component
#add_classes, #badge_html, #class_and_html_options, #glyph, #glyph_and_content_html, #glyph_with_space, #state
Methods inherited from Base
Constructor Details
- (ProgressBar) initialize(content = nil, options = nil, html_options = nil, &block)
See UiBibz::Ui::Core::Component.initialize
71 72 73 74 |
# File 'lib/ui_bibz/ui/core/progress_bar/progress_bar.rb', line 71 def initialize content = nil, = nil, = nil, &block super @bars = [] end |
Instance Method Details
- (Object) bar(content = nil, options = nil, html_options = nil, &block)
Add progressbar bar items See UiBibz::Ui::Core::Bar
83 84 85 |
# File 'lib/ui_bibz/ui/core/progress_bar/progress_bar.rb', line 83 def content = nil, = nil, = nil, &block @bars << Bar.new(content, , , &block).render end |
- (Object) render
Render html tag
77 78 79 |
# File 'lib/ui_bibz/ui/core/progress_bar/progress_bar.rb', line 77 def render content_tag :div, content, class: 'progress' end |