Files
ubicloud/views/components/form/checkbox.erb
Jeremy Evans 0c96b23bdc Remove error handling for checkbox view
We do not have any places that set errors on checkboxes.
Current checkbox users:

* Partnership notice: We don't even give the input a name
  we only set a required attribute, so it is not checked
  at all by the backend.

* Vm creation form: Used for IPv4, and never an error
  because either checked or unchecked is fine.

* Access Control form: Used for marking rows for deletion,
  and either checked or unchecked is fine.

* Tag membership: Used for marking rows for inclusion, and
  either checked or unchecked is fine.

If we ever have a checkbox that needs error handling, it's fine
to revert this.

After changes:

Line Coverage: 99.91% (11700 / 11711)
Branch Coverage: 98.79% (3098 / 3136)
2025-01-14 09:04:22 -08:00

37 lines
1.3 KiB
Plaintext

<%# locals: (name: nil, id_prefix: nil, label: nil, options: {}, description: nil, attributes: {}) %>
<div class="space-y-2 text-gray-900">
<% if label %>
<label class="block text-sm font-medium leading-6"><%== label %></label>
<% end %>
<fieldset>
<div class="space-y-5">
<% options.each_with_index do |(opt_val, opt_text, opt_classes, opt_attrs), idx| %>
<% id = "#{id_prefix}#{name}-#{opt_val}-#{idx}" %>
<div class="relative flex items-start <%= opt_classes %>">
<div class="flex h-6 items-center">
<input
id="<%= id %>"
name="<%= name %>"
type="checkbox"
value="<%= opt_val %>"
class="h-4 w-4 rounded border-gray-300 text-orange-600 focus:ring-orange-600"
<% (opt_attrs || {}).each do |opt_atr_key, opt_atr_value| %>
<%= opt_atr_key %>="<%= opt_atr_value %>"
<% end%>
>
</div>
<% if opt_text %>
<div class="ml-3 text-sm leading-6">
<label for="<%= id %>" class="font-medium text-gray-900"><%== opt_text %></label>
</div>
<% end %>
</div>
<% end %>
</div>
</fieldset>
<% if description %>
<p class="text-sm text-gray-500 leading-6"><%== description %></p>
<% end %>
</div>