blob: b1c2b1eb021a84587d7832ac0ffaea26e5a70e41 (
plain) (
tree)
|
|
module ApplicationHelper
def required_label_tag(form, field, text = nil)
label_content = text || field.to_s.titleize
required = form.object.class.validators_on(field).any? { |v| v.is_a?(ActiveRecord::Validations::PresenceValidator) }
form.label field, class: "font-bold" do
required ? "#{label_content} <span class='text-red-500'>*</span>".html_safe : label_content
end
end
end
|