diff options
author | Marius Peter <marius.peter@tutanota.com> | 2024-12-29 15:14:43 +0100 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2024-12-29 15:14:43 +0100 |
commit | be2a93525069de2dfa3c23b0c23e7a9f7ad4c03d (patch) | |
tree | b5493e9d35d024ce7be072ec2168b4a98ba0e63f /app/views/scores |
First commit.
Diffstat (limited to 'app/views/scores')
-rw-r--r-- | app/views/scores/_form.html.erb | 19 | ||||
-rw-r--r-- | app/views/scores/edit_all.html.erb | 7 | ||||
-rw-r--r-- | app/views/scores/new.html.erb | 7 |
3 files changed, 33 insertions, 0 deletions
diff --git a/app/views/scores/_form.html.erb b/app/views/scores/_form.html.erb new file mode 100644 index 0000000..9cbcec7 --- /dev/null +++ b/app/views/scores/_form.html.erb @@ -0,0 +1,19 @@ +<%= 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> + <%= select_tag "scores[#{criterium.id}][value]", + options_for_select(1..5, current_score&.value), + required: true, + prompt: "Score" %> + <%= label_tag "scores[#{criterium.id}][value]", + criterium.name.capitalize %> + </p> + <% end %> + </fieldset> + <% end %> + <%= f.submit submit_text %> +<% end %> diff --git a/app/views/scores/edit_all.html.erb b/app/views/scores/edit_all.html.erb new file mode 100644 index 0000000..2be7149 --- /dev/null +++ b/app/views/scores/edit_all.html.erb @@ -0,0 +1,7 @@ +<h1>Modifier les Notes pour la Tartiflette nº<%= @tartiflette.scoring_id %></h1> + +<%= render "form", + form_url: tartiflette_update_scores_path(@tartiflette), + form_method: :patch, + existing_scores: @scores, + submit_text: "Mettre à jour mes scores" %> diff --git a/app/views/scores/new.html.erb b/app/views/scores/new.html.erb new file mode 100644 index 0000000..cf171cc --- /dev/null +++ b/app/views/scores/new.html.erb @@ -0,0 +1,7 @@ +<h1>Noter la Tartiflette nº<%= @tartiflette.scoring_id %></h1> + +<%= render "form", + form_url: tartiflette_scores_path(@tartiflette), + form_method: :post, + existing_scores: [], + submit_text: "Envoyer mes scores" %> |