Class: BulmaPhlex::ProgressBar

Inherits:
Base
  • Object
show all
Defined in:
lib/bulma_phlex/progress_bar.rb

Overview

Renders the [Bulma progress bar element](bulma.io/documentation/elements/progress/).

Supports color and size options. Omitting ‘value` and `max` from the HTML attributes produces an indeterminate (animated) progress bar.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color: nil, size: nil, **html_attributes) ⇒ ProgressBar

Returns a new instance of ProgressBar.



19
20
21
22
23
# File 'lib/bulma_phlex/progress_bar.rb', line 19

def initialize(color: nil, size: nil, **html_attributes)
  @color = color
  @size = size
  @html_attributes = html_attributes
end

Class Method Details

.new(color: nil, size: nil, **html_attributes) ⇒ Object

Parameters

‘“normal”`, `“medium”`, `“large”`

  • ‘**html_attributes` — Additional HTML attributes for the progress element; use `value` and `max` to set progress



15
16
17
# File 'lib/bulma_phlex/progress_bar.rb', line 15

def self.new(color: nil, size: nil, **html_attributes)
  super
end

Instance Method Details

#view_templateObject



25
26
27
# File 'lib/bulma_phlex/progress_bar.rb', line 25

def view_template(&)
  progress(**mix({ class: classes }, @html_attributes), &)
end