Use <legend> tags to group radio button fields

In a few places, we were using <label> tags that pointed to elements
that didn't exist.
This commit is contained in:
Javi Martín
2025-07-09 15:23:10 +02:00
parent cb57b0c0c1
commit d5b4e5b7b9
6 changed files with 29 additions and 11 deletions

View File

@@ -3,14 +3,14 @@
<%= render "shared/errors" %>
<div class="row expanded">
<div class="small-12 medium-4 column">
<%= f.label :action_type %>
<fieldset class="small-12 medium-4 column">
<legend><%= attribute_name(:action_type) %></legend>
<% ::Dashboard::Action.action_types.keys.each do |action_type_value| %>
<span class="margin-right">
<%= f.radio_button :action_type, action_type_value %>
</span>
<% end %>
</div>
</fieldset>
<div class="small-12 column margin-top">
<%= f.check_box :active %>

View File

@@ -5,4 +5,10 @@ class Admin::Dashboard::Actions::FormComponent < ApplicationComponent
@dashboard_action = dashboard_action
@url_action = url_action
end
private
def attribute_name(attribute)
Dashboard::Action.human_attribute_name(attribute)
end
end

View File

@@ -60,14 +60,14 @@
</div>
<div class="row">
<div class="small-12 medium-9 column">
<%= f.label :status %>
<fieldset class="small-12 column">
<legend><%= attribute_name(:status) %></legend>
<% ::Legislation::DraftVersion::VALID_STATUSES.each do |status| %>
<%= f.radio_button :status, status %>
<span class="help-text"><%= t("admin.legislation.draft_versions.form.hints.status.#{status}") %></span>
<br>
<% end %>
</div>
</fieldset>
<div class="small-12 medium-9 column">
<%= f.check_box :final_version %>

View File

@@ -11,6 +11,10 @@ class Admin::Legislation::DraftVersions::FormComponent < ApplicationComponent
private
def attribute_name(attribute)
Legislation::DraftVersion.human_attribute_name(attribute)
end
def process
draft_version.process
end

View File

@@ -10,11 +10,13 @@
<div class="small-12 medium-4 column">
<h3><%= t("admin.site_customization.pages.form.options") %></h3>
<%= f.label :status %>
<fieldset>
<legend><%= attribute_name(:status) %></legend>
<% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %>
<%= f.radio_button :status, status %>
<br>
<% end %>
</fieldset>
<%= f.check_box :more_info_flag, class: "small" %>
<%= f.check_box :print_content_flag %>

View File

@@ -6,4 +6,10 @@ class Admin::SiteCustomization::Pages::FormComponent < ApplicationComponent
def initialize(page)
@page = page
end
private
def attribute_name(attribute)
SiteCustomization::Page.human_attribute_name(attribute)
end
end