chore(form): InputComponent with asterisk on required inputs
This commit is contained in:
parent
b85a897237
commit
1fbfc9fce1
2 changed files with 9 additions and 0 deletions
|
@ -67,6 +67,10 @@ class Dsfr::InputComponent < ApplicationComponent
|
|||
@input_type == :email_field
|
||||
end
|
||||
|
||||
def required?
|
||||
@required
|
||||
end
|
||||
|
||||
def show_password_id
|
||||
dom_id(object, "#{@attribute}_show_password")
|
||||
end
|
||||
|
|
|
@ -2,8 +2,13 @@
|
|||
= @form.label @attribute, label_opts do
|
||||
- capture do
|
||||
= label
|
||||
|
||||
- if required?
|
||||
= render EditableChamp::AsteriskMandatoryComponent.new
|
||||
|
||||
- if hint?
|
||||
%span.fr-hint-text= hint
|
||||
|
||||
= @form.public_send(@input_type, @attribute, input_opts)
|
||||
|
||||
- if errors_on_attribute?
|
||||
|
|
Loading…
Reference in a new issue