From b0b481f95d2835c9af6a6e818761c5282e48023a Mon Sep 17 00:00:00 2001 From: Serena Abbott Date: Tue, 3 Dec 2024 09:43:02 +0000 Subject: [PATCH] Add evaluators link and status change functionality to tasklist --- app/controllers/support/cases/evaluators_controller.rb | 7 +++++++ app/views/support/cases/show/_tasklist.html.erb | 2 +- spec/features/support/case_tasklist_spec.rb | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/support/cases/evaluators_controller.rb b/app/controllers/support/cases/evaluators_controller.rb index 2376f71f2..75d7bfcd1 100644 --- a/app/controllers/support/cases/evaluators_controller.rb +++ b/app/controllers/support/cases/evaluators_controller.rb @@ -3,6 +3,13 @@ class Cases::EvaluatorsController < Cases::ApplicationController before_action :set_current_case before_action :set_evaluator, only: %i[edit update destroy] + before_action only: %i[new create edit update destroy] do + @back_url = support_case_evaluators_path(@current_case) + end + + before_action only: [:index] do + @back_url = support_case_path(@current_case, anchor: "tasklist") + end def index @evaluators = @current_case.evaluators.all end diff --git a/app/views/support/cases/show/_tasklist.html.erb b/app/views/support/cases/show/_tasklist.html.erb index 352157ac9..e7602608a 100644 --- a/app/views/support/cases/show/_tasklist.html.erb +++ b/app/views/support/cases/show/_tasklist.html.erb @@ -8,7 +8,7 @@ <%= I18n.t("support.case.label.tasklist.complete_evaluation") %> <%= govuk_task_list(id_prefix: "complete-evaluation") do |task_list| - task_list.with_item(title: I18n.t("support.case.label.tasklist.item.add_evaluators"), href: '#', status: govuk_tag(text: I18n.t("support.case.label.tasklist.status.to_do"))) + task_list.with_item(title: I18n.t("support.case.label.tasklist.item.add_evaluators"), href: support_case_evaluators_path(@current_case), status: @current_case.evaluators.present? ? govuk_tag(text: I18n.t("support.case.label.tasklist.status.complete"), colour: "green") : govuk_tag(text: I18n.t("support.case.label.tasklist.status.to_do"))) task_list.with_item(title: I18n.t("support.case.label.tasklist.item.set_due_date"), href: edit_support_case_evaluation_due_dates_path(@current_case), status: @current_case.evaluation_due_date ? govuk_tag(text: I18n.t("support.case.label.tasklist.status.complete"), colour: "green") : govuk_tag(text: I18n.t("support.case.label.tasklist.status.to_do"))) if @current_case.has_uploaded_documents == true diff --git a/spec/features/support/case_tasklist_spec.rb b/spec/features/support/case_tasklist_spec.rb index a97716e98..94c61c470 100644 --- a/spec/features/support/case_tasklist_spec.rb +++ b/spec/features/support/case_tasklist_spec.rb @@ -13,6 +13,14 @@ expect(page).to have_text("Procurement task list") expect(page).to have_text("Complete evaluation") expect(page).to have_css(".govuk-task-list") + expect(page).to have_link("Add evaluators") + end + end + + it "navigates to the add evaluators page when clicked" do + within "#tasklist" do + click_link "Add evaluators" + expect(page).to have_current_path("/support/cases/#{support_case.id}/evaluators") end end end