summaryrefslogtreecommitdiff
path: root/app/views/scores/_form.html.erb
blob: e8610c613834234b2eacf7ebba0c23a8243be14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<%= 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)",
					 size: 10 %>
		    <%= label_tag "scores[#{criterium.id}][value]",
				  criterium.name.capitalize %>
		</p>
	    <% end %>
	</fieldset>
    <% end %>
    <%= f.submit submit_text %>
<% end %>
Copyright 2019--2025 Marius PETER