We have nothing that sets an error for textareas. The current textareas in Clover: * Vm creation form: Marked as required, so browser won't submit the form without the field being filled out, but if a user can remove the required flag to work around that. If we want to enforce that Vms have public keys, we can do that, but it currently breaks a number of tests, and there is little point to validating only that the field is not empty. * Inference playground: Form doesn't submit normally, it's managed with javascript, so form never renders with errors. * Billing form: Uses Stripe, all Stripe errors result in a redirect with a flash error being set, but no field errors being set, and all changes made to the form being lost. If we ever have a textarea that needs error handling, it's fine to revert this. After changes: Line Coverage: 99.88% (11705 / 11719) Branch Coverage: 98.57% (3097 / 3142)
20 lines
831 B
Plaintext
20 lines
831 B
Plaintext
<%# locals: (name: nil, value: nil, label: nil, description: nil, attributes: {}) %>
|
|
<% value = flash.dig("old", name) || value %>
|
|
|
|
<div class="space-y-2">
|
|
<% if label %>
|
|
<label for="<%= name %>" class="block text-sm font-medium leading-6 text-gray-900"><%= label %></label>
|
|
<% end %>
|
|
<textarea
|
|
id="<%= name %>"
|
|
name="<%= name %>"
|
|
class="block w-full rounded-md border-0 sm:py-1.5 shadow-sm ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6 text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-orange-600"
|
|
<% attributes.each do |atr_key, atr_value| %>
|
|
<%= atr_key %>="<%= atr_value %>"
|
|
<% end%>
|
|
><%= value %></textarea>
|
|
<% if description %>
|
|
<p class="text-sm text-gray-500 leading-6" id="<%= name %>-description"><%= description %></p>
|
|
<% end %>
|
|
</div>
|