Skip to content

Commit

Permalink
Add evaluators link and status change functionality to tasklist
Browse files Browse the repository at this point in the history
  • Loading branch information
serenaabbott11 committed Dec 9, 2024
1 parent b36039d commit 4e8a441
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/controllers/support/cases/evaluators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/support/cases/show/_tasklist.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%= I18n.t("support.case.label.tasklist.complete_evaluation") %>
</h3>
<%= 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")))
task_list.with_item(title: I18n.t("support.case.label.tasklist.item.upload_documents"), 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.email_evaluators")) do | item |
Expand Down
8 changes: 8 additions & 0 deletions spec/features/support/case_tasklist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e8a441

Please sign in to comment.