Module: StimulusPlumbers::Form::Fields::Inputs::Password

Includes:
Revealable, Strength
Included in:
Builder
Defined in:
lib/stimulus_plumbers/form/fields/inputs/password.rb,
lib/stimulus_plumbers/form/fields/inputs/password/strength.rb,
lib/stimulus_plumbers/form/fields/inputs/password/revealable.rb

Defined Under Namespace

Modules: Revealable, Strength

Constant Summary collapse

DEFAULT_AUTOCOMPLETE =
"current-password"

Constants included from Revealable

Revealable::STIMULUS_ACTION, Revealable::STIMULUS_CONTROLLER

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#password_requirementsObject (readonly)

Requirements collected from a field block, held for the renderer.



32
33
34
# File 'lib/stimulus_plumbers/form/fields/inputs/password.rb', line 32

def password_requirements
  @password_requirements
end

Instance Method Details

#password_field(attribute, floating: nil, revealable: false, **options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stimulus_plumbers/form/fields/inputs/password.rb', line 16

def password_field(attribute, floating: nil, revealable: false, **options)
  html_options = merge_html_options(
    theme.resolve(:form_field_input, floating: floating),
    options,
    { autocomplete: options.delete(:autocomplete) || DEFAULT_AUTOCOMPLETE }
  )
  if revealable
    render_revealable_password(false) do
      super(attribute, merge_html_options(html_options, { data: { input_revealable_target: "input" } }))
    end
  else
    super(attribute, html_options)
  end
end