Module: KisoThemes::SimpleForm::RequiredTag

Defined in:
lib/kiso_themes/extensions/simple_form/required_component.rb

Overview

Custom SimpleForm component to add a ‘Required’ tag next to required inputs when there are no errors.

Instance Method Summary collapse

Instance Method Details

#required_tag(_wrapper_options = nil) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/kiso_themes/extensions/simple_form/required_component.rb', line 6

def required_tag(_wrapper_options = nil)
  return unless required_field? && !has_errors?

  template. :div,
                       template.fa_icon_tag('asterisk') + ' ' + translate_required_text,
                       class: 'help-block'
end

#translate_required_textObject



14
15
16
# File 'lib/kiso_themes/extensions/simple_form/required_component.rb', line 14

def translate_required_text
  I18n.t(:"simple_form.required.text", default: 'required')
end