Fix invalid HTML in document/image fields labels

These labels weren't associated with any fields, which is invalid HTML.
We're using a legend inside a fieldset instead, which is the natural way
to group form fields together.
This commit is contained in:
Javi Martín
2021-07-12 00:31:40 +02:00
parent c9903f36cc
commit 394a94cbff
2 changed files with 25 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
<div class="documents-list">
<%= f.label :documents, t("documents.form.title") %>
<fieldset class="documents-list">
<legend><%= t("documents.form.title") %></legend>
<p class="help-text"><%= note %></p>
<div id="nested-documents" data-max-documents-allowed="<%= max_documents_allowed %>">
@@ -21,4 +21,4 @@
<div id="max-documents-notice" class="max-documents-notice callout primary text-center <%= "hide" unless max_documents_allowed? %>">
<%= sanitize(t("documents.max_documents_allowed_reached")) %>
</div>
</div>
</fieldset>

View File

@@ -1,22 +1,24 @@
<%= f.label image_fields, t("images.form.title") %>
<p class="help-text"><%= note %></p>
<fieldset>
<legend><%= t("images.form.title") %></legend>
<p class="help-text"><%= note %></p>
<div id="nested-image">
<%= f.fields_for image_fields do |image_builder| %>
<%= render Images::FieldsComponent.new(image_builder, imageable: imageable) %>
<% end %>
</div>
<div id="nested-image">
<%= f.fields_for image_fields do |image_builder| %>
<%= render Images::FieldsComponent.new(image_builder, imageable: imageable) %>
<% end %>
</div>
<%= link_to_add_association t("images.form.add_new_image"), f, image_fields,
force_non_association_create: true,
partial: "images/image_fields",
id: "new_image_link",
class: "button upload-image
#{"hide" if image_fields == :image && imageable.image.present?}",
render_options: {
locals: { imageable: imageable }
},
data: {
association_insertion_node: "#nested-image",
association_insertion_method: "append"
} %>
<%= link_to_add_association t("images.form.add_new_image"), f, image_fields,
force_non_association_create: true,
partial: "images/image_fields",
id: "new_image_link",
class: "button upload-image
#{"hide" if image_fields == :image && imageable.image.present?}",
render_options: {
locals: { imageable: imageable }
},
data: {
association_insertion_node: "#nested-image",
association_insertion_method: "append"
} %>
</fieldset>