From e289434874e24199961d1b22d7f68a042fc3ab31 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Thu, 9 Sep 2021 13:49:39 +0200 Subject: [PATCH] Split form card --- app/assets/javascripts/evaluation.ts | 4 ++ app/views/evaluations/_form.html.erb | 19 +++++---- app/views/evaluations/edit.html.erb | 51 ++++++++++++------------- app/views/evaluations/new.html.erb | 46 +++++++++++++++------- config/locales/views/evaluations/en.yml | 1 + config/locales/views/evaluations/nl.yml | 1 + 6 files changed, 72 insertions(+), 50 deletions(-) diff --git a/app/assets/javascripts/evaluation.ts b/app/assets/javascripts/evaluation.ts index 3e4a1606e6..bc14727d39 100644 --- a/app/assets/javascripts/evaluation.ts +++ b/app/assets/javascripts/evaluation.ts @@ -43,6 +43,7 @@ export function initEvaluationStepper(): void { userPanel.hide(); }); + document.querySelector("#users-step-finish-button").addEventListener("click", function () { userPanel.hide(); document.querySelector("#items-panel").classList.remove("hidden"); @@ -50,6 +51,7 @@ export function initEvaluationStepper(): void { }); } + function toUsersStep(): void { interceptAddMultiUserClicks(); initCheckboxes(); @@ -57,6 +59,8 @@ export function initEvaluationStepper(): void { document.querySelector("#users-panel").classList.remove("hidden"); evalPanel.hide(); userPanel.show(); + document.querySelector("#users-panel a[role=\"button\"]").setAttribute("href", "#users-step"); + document.querySelector("#items-panel a[role=\"button\"]").setAttribute("href", "#items-step"); } function interceptAddMultiUserClicks(): void { diff --git a/app/views/evaluations/_form.html.erb b/app/views/evaluations/_form.html.erb index c303ec12f7..228520f463 100644 --- a/app/views/evaluations/_form.html.erb +++ b/app/views/evaluations/_form.html.erb @@ -4,23 +4,22 @@ <%= form_for evaluation, html: { class: "form-horizontal feedback-form" }, remote: true do |f| %>
<%= f.hidden_field :series_id %> -

<%= evaluation.series.name %> <%= evaluation.series.course.name %>

- - <%= render partial: 'exercises_table', locals: { - series: @evaluation.series, - exercises: @evaluation.series.exercises, - } %> - -
Deadline
Time.current %>"> -
+
+
+
Deadline
<%= f.text_field :deadline, class: "form-control", 'data-input': true %>
- <%= t(".deadline-help_html") %> +
+
+ <%= t(".deadline-help_html") %> +
+
+
diff --git a/app/views/evaluations/edit.html.erb b/app/views/evaluations/edit.html.erb index dff1f5463f..00e7e4cd80 100644 --- a/app/views/evaluations/edit.html.erb +++ b/app/views/evaluations/edit.html.erb @@ -4,38 +4,37 @@ <% end %>
-
-
- -
-
-
-
-
-
-

<%= t "evaluations.new.explanation_title" %>

- <%= t "evaluations.new.explanation_html" %> -
-
-
- <%= render 'form', evaluation: @evaluation, readonly: true %> -
-
+
+
+

<%= @title %>

+
+
+
+
+

+ <%= @evaluation.series.name %> + <%= @evaluation.series.course.name %> +

+ <%= render partial: 'exercises_table', locals: { + series: @evaluation.series, + exercises: @evaluation.series.exercises, + } %> +
+ +
+
+

<%= t "evaluations.new.explanation_title" %>

+ <%= t "evaluations.new.explanation_html" %>
+
+