refactor(input): don't duplicate hint logic

This commit is contained in:
Colin Darie 2024-07-24 17:14:06 +02:00
parent 90e6c8a6f6
commit 49be3a797a
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -127,6 +127,8 @@ module Dsfr
end
end
def hint? = hint.present?
def password?
false
end
@ -142,15 +144,6 @@ module Dsfr
def hintable?
false
end
def hint?
return true if get_slot(:hint).present?
maybe_hint = I18n.exists?("activerecord.attributes.#{object.class.name.underscore}.hints.#{@attribute}")
maybe_hint_html = I18n.exists?("activerecord.attributes.#{object.class.name.underscore}.hints.#{@attribute}_html")
maybe_hint || maybe_hint_html
end
end
end
end