Files
ubicloud/views/components/form/textarea.erb
Jeremy Evans dd9a51da2e Fix required="true" attributes
Add a custom validator looking for {required,checked}={true,false}
attributes. This found numerous cases.

Add an html_attrs method that handles required/checked attributes
properly, skipping them if the value is false, and using them
without a value if the value is true.

Change all attribute handling to use html_attrs to fix the issue.
2025-05-13 06:24:13 +09:00

18 lines
765 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"
<%== html_attrs(attributes) %>
><%= value %></textarea>
<% if description %>
<p class="text-sm text-gray-500 leading-6" id="<%= name %>-description"><%= description %></p>
<% end %>
</div>