blob: 50dd25f42fce805fced792f486b9af77937a1711 (
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 } %>
<%= number_field_tag "scores[#{criterium.id}][value]",
current_score&.value,
in: 1..5,
required: true,
placeholder: "Score (1-5)",
size: 10 %>
<%= label_tag "scores[#{criterium.id}][value]",
criterium.name.capitalize %>
<br/>
<% end %>
</fieldset>
<% end %>
<%= f.submit submit_text %>
<% end %>
|