class NfgUi::Components::Elements::Step

Step doc coming soon

Public Instance Methods

active() click to toggle source

Override active from Activatable

# File lib/nfg_ui/components/elements/step.rb, line 16
def active
  # Active is a transitory state for steps
  # So when a step is active, it is automatically visited.
  # This sets visited to true.
  # This is also accounted for in the #active_trait for steps.
  options[:visited] = true if options[:active]
  super
end
component_family() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 25
def component_family
  :steps
end
disabled() click to toggle source

NOTE: DISABLED TOOLTIPS DO NOT YET WORK ON STEPS NAVITEM DOES NOT INCLUDE DISABLEABLE MODULE JR: 06-21-2019

# File lib/nfg_ui/components/elements/step.rb, line 32
def disabled
  options[:disabled] || (!visited && !active)
end
render() { |: body), icon: icon, href: href, disabled: disabled| ... } click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 36
def render
  content_tag(as, html_options) do
    NfgUi::Components::Elements::StepIndicator.new({ step: step.to_s, body: (block_given? ? yield : body), icon: icon, href: href, disabled: disabled }, view_context).render
  end
end
step() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 42
def step
  options.fetch(:step, nil)
end
visited() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 46
def visited
  options.fetch(:visited, false)
end

Private Instance Methods

base_element() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 52
def base_element
  as
end
css_classes() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 56
def css_classes
  [
    super,
    ('visited' if visited)
  ].join(' ').squish
end
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/components/elements/step.rb, line 63
def non_html_attribute_options
  super.push(:visited, :step)
end