Class: PasswordWithSyncInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- PasswordWithSyncInput
- Defined in:
- lib/simple_form_password_with_hints/password_with_sync_input.rb
Instance Method Summary collapse
- #controls ⇒ Object
- #input(wrapper_options = nil) ⇒ Object
- #linked_field_name ⇒ Object
- #password_uncloaking_div ⇒ Object
Instance Method Details
#controls ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/simple_form_password_with_hints/password_with_sync_input.rb', line 26 def controls template.content_tag(:div, '', class: 'sfpwh-controls js-sfpwh-controls') do template.content_tag( :span, t('simple_form_password_with_hints.test_fields_matching'), class: 'sfpwh-hint sfpwh-hint--invalid sfpwh-hint--match js-sfpwh-hint-match' ) end end |
#input(wrapper_options = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/simple_form_password_with_hints/password_with_sync_input.rb', line 4 def input( = nil) = (, ) [:class] << " js-sfpwh-input js-sfpwh-sync-input " input_wrapper_class = 'sfpwh-input-div' input_wrapper_class += ' sfpwh-input-div-invalid' if has_errors? if [:compare_with_field] if [:data].nil? [:data] = { link_to: linked_field_name } else [:data][:link_to] = linked_field_name end ( template.content_tag(:div, '', class: input_wrapper_class) do [ @builder.password_field(attribute_name, ) + password_uncloaking_div ].compact.join.html_safe end ) + controls else @builder.password_field(attribute_name, ) end end |
#linked_field_name ⇒ Object
44 45 46 |
# File 'lib/simple_form_password_with_hints/password_with_sync_input.rb', line 44 def linked_field_name "#{@builder.object_name}[#{[:compare_with_field]}]" end |
#password_uncloaking_div ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/simple_form_password_with_hints/password_with_sync_input.rb', line 36 def password_uncloaking_div template.content_tag( :span, '', class: 'sfpwh-password-toggle js-sfpwh-password-toggle' ) if [:allow_password_uncloaking] end |