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 "management/**/*";
@import "milestones/**/*"; @import "milestones/**/*";
@import "moderation/**/*"; @import "moderation/**/*";
@import "officing/**/*";
@import "polls/**/*"; @import "polls/**/*";
@import "proposals/**/*"; @import "proposals/**/*";
@import "relationable/**/*"; @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="row">
<div class="small-12 medium-6 column"> <div class="small-12 medium-6 column">
<%= label_tag :officer_assignment_id, t("officing.results.new.booth") %> <%= label_tag :officer_assignment_id, t("officing.results.new.booth") %>
@@ -9,17 +9,15 @@
</div> </div>
<% poll.questions.each do |question| %> <% poll.questions.each do |question| %>
<div class="row"> <fieldset class="row">
<div class="small-12 column"> <legend class="column"><%= question.title %></legend>
<h3><%= question.title %></h3>
</div>
<% question.question_options.each_with_index do |option, i| %> <% question.question_options.each_with_index do |option, i| %>
<div class="small-12 medium-6 large-3 column end"> <div class="small-12 medium-6 large-3 column end">
<%= label_tag "questions_#{question.id}_#{i}", option.title %> <%= label_tag "questions_#{question.id}_#{i}", option.title %>
<%= text_field_tag "questions[#{question.id}][#{i}]", answer_result_value(question.id, i), placeholder: "0" %> <%= text_field_tag "questions[#{question.id}][#{i}]", answer_result_value(question.id, i), placeholder: "0" %>
</div> </div>
<% end %> <% end %>
</div> </fieldset>
<hr> <hr>
<% end %> <% end %>

View File

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