% yield %> <% form ||= current_fields_form # returns a struct with `label`, `placeholder`, and `help` methods. labels = labels_for(form, method) options ||= {} options[:id] ||= form.field_id(method) # options[:disabled] ||= !field_editable?(form.object, method) if user_signed_in? options[:placeholder] ||= labels.placeholder if labels.placeholder other_options ||= {} other_options[:help] = [other_options[:help], labels.help].compact.join(" ") errors = [method, method.to_s.gsub(/_id$/, '').to_sym].uniq.map { |attribute| form.object.errors.full_messages_for(attribute) }.flatten has_errors = errors.any? || content_for(:error).present? || other_options[:error].present? options[:class] = "#{options[:class]} block w-full rounded-md shadow-sm font-light text-sm dark:bg-slate-800 dark:text-slate-300" options[:class] += if has_errors " pr-10 border-red-500 text-red-900 placeholder-red-500 outline-none focus:ring-red-500 focus:border-red-500 dark:text-slate-300" else " focus:ring-primary-500 focus:border-primary-500 border-slate-300 dark:border-slate-900" end %>
<%= errors.map { |error| error + ". " }.join %> <%= yield :error %> <% flush_content_for :error %> <% if other_options[:hide_custom_error].blank? %> <%= other_options[:error]&.html_safe %> <% end %>
<% end %> <% # any help text. %> <% if content_for?(:help) || other_options[:help].present? || content_for?(:after_help) %><%= yield :help %> <% flush_content_for :help %> <%= other_options[:help]&.html_safe %> <%= yield :after_help %> <% flush_content_for :after_help %>
<% end %> <% if other_options[:icon] %> <% end %>