blob: 87a924eda337a381330a505cf8ee2063369a756d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<%= form_with url: form_url, method: form_method, local: true do |f| %>
<% ScoringCriterium.grouped_by_category.each do |category, criteria| %>
<fieldset>
<legend><%= category.titlecase %></legend>
<% criteria.each do |criterium| %>
<% current_score = existing_scores.find { |score| score.scoring_criterium_id == criterium.id } %>
<p>
<%= number_field_tag "scores[#{criterium.id}][value]",
current_score&.value,
in: 1..5,
required: true,
placeholder: "Score (1-5)" %>
<%= label_tag "scores[#{criterium.id}][value]",
criterium.name.capitalize %>
</p>
<% end %>
</fieldset>
<% end %>
<%= f.submit submit_text %>
<% end %>
|