Use fieldsets and legends in officing results form

We were using <h3> tags instead of a combination of <fieldset> and
<legend> tags to group fields together.
This commit is contained in:
Javi Martín
2025-04-02 18:28:45 +02:00
parent 31f413de61
commit ff3ada780d
4 changed files with 23 additions and 12 deletions

View File

@@ -29,6 +29,7 @@
@import "management/**/*";
@import "milestones/**/*";
@import "moderation/**/*";
@import "officing/**/*";
@import "polls/**/*";
@import "proposals/**/*";
@import "relationable/**/*";

View File

@@ -0,0 +1,5 @@
.officing-results-form {
legend {
@include header-font-size(h3);
}
}

View File

@@ -1,4 +1,4 @@
<%= form_tag(officing_poll_results_path(poll), { id: "officer_assignment_form" }) do %>
<%= form_tag(officing_poll_results_path(poll), { id: "officer_assignment_form", class: "officing-results-form" }) do %>
<div class="row">
<div class="small-12 medium-6 column">
<%= label_tag :officer_assignment_id, t("officing.results.new.booth") %>
@@ -9,17 +9,15 @@
</div>
<% poll.questions.each do |question| %>
<div class="row">
<div class="small-12 column">
<h3><%= question.title %></h3>
</div>
<fieldset class="row">
<legend class="column"><%= question.title %></legend>
<% question.question_options.each_with_index do |option, i| %>
<div class="small-12 medium-6 large-3 column end">
<%= label_tag "questions_#{question.id}_#{i}", option.title %>
<%= text_field_tag "questions[#{question.id}][#{i}]", answer_result_value(question.id, i), placeholder: "0" %>
</div>
<% end %>
</div>
</fieldset>
<hr>
<% end %>

View File

@@ -59,11 +59,15 @@ describe "Officing Results", :with_frozen_time do
select booth.name, from: "Booth"
within_fieldset question_1.title do
fill_in "Yes", with: "100"
fill_in "No", with: "200"
end
within_fieldset question_2.title do
fill_in "Today", with: "333"
fill_in "Tomorrow", with: "444"
end
fill_in "Totally blank ballots", with: "66"
fill_in "Invalid ballots", with: "77"
@@ -102,8 +106,11 @@ describe "Officing Results", :with_frozen_time do
booth_name = partial_result.booth_assignment.booth.name
select booth_name, from: "Booth"
within_fieldset question_1.title do
fill_in "Yes", with: "5555"
fill_in "No", with: "200"
end
fill_in "Totally blank ballots", with: "6"
fill_in "Invalid ballots", with: "7"
fill_in "Valid ballots", with: "8"