Class: CCS::Components::CCS::PasswordStrength
- Defined in:
- lib/ccs/components/ccs/password_strength.rb,
lib/ccs/components/ccs/password_strength/test.rb
Overview
CCS Password Strength
This is used for generating the contact us component from the CCS - Components - Password strength
Defined Under Namespace
Classes: Test
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for password strength
{ class: 'ccs-password-strength', data: { module: 'ccs-password-strength' } }.freeze
Instance Method Summary collapse
-
#initialize(password_id:, password_strength_tests:) ⇒ PasswordStrength
constructor
A new instance of PasswordStrength.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the CCS password strength component.
Constructor Details
#initialize(password_id:, password_strength_tests:) ⇒ PasswordStrength
Returns a new instance of PasswordStrength.
29 30 31 32 33 34 35 |
# File 'lib/ccs/components/ccs/password_strength.rb', line 29 def initialize(password_id:, password_strength_tests:, **) super(**) @options[:attributes][:data][:target] = password_id @password_strength_tests = password_strength_tests.map { |password_strength_test| Test.new(context: @context, **password_strength_test) } end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the CCS password strength component
41 42 43 44 45 |
# File 'lib/ccs/components/ccs/password_strength.rb', line 41 def render tag.ul(**[:attributes]) do password_strength_tests.each { |password_strength_test| concat(password_strength_test.render) } end end |