summaryrefslogtreecommitdiff
path: root/app/views/scores/_form.html.erb
blob: f60efa3efd0255d67522af832ece01a94ba94cc4 (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 %>
Copyright 2019--2025 Marius PETER