From ceb67988a2e403afb5ccc47835130d01c9fc5f33 Mon Sep 17 00:00:00 2001 From: Kat Date: Fri, 30 Jun 2023 16:48:01 +0100 Subject: [PATCH] Update breadcrumbs for closed period --- app/helpers/review_helper.rb | 16 ++++++++++++++++ app/views/form/review.html.erb | 6 +----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/helpers/review_helper.rb b/app/helpers/review_helper.rb index c8918708e..502c11b5d 100644 --- a/app/helpers/review_helper.rb +++ b/app/helpers/review_helper.rb @@ -9,4 +9,20 @@ module ReviewHelper "This log is from the #{start_year}/#{start_year + 1} collection window, which is now closed." end end + + def review_breadcrumbs(log) + class_name = log.class.model_name.human.downcase + if log.collection_closed_for_editing? + content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { + "Logs" => url_for(log.class), + "Log #{log.id}" => "", + }) + else + content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { + "Logs" => url_for(log.class), + "Log #{log.id}" => url_for(log), + "Review #{class_name}" => "", + }) + end + end end diff --git a/app/views/form/review.html.erb b/app/views/form/review.html.erb index 17bc1fbcc..9a94059e4 100644 --- a/app/views/form/review.html.erb +++ b/app/views/form/review.html.erb @@ -1,10 +1,6 @@ <% class_name = @log.class.model_name.human.downcase %> <% content_for :title, "Review #{class_name}" %> -<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { - "Logs" => url_for(@log.class), - "Log #{@log.id}" => url_for(@log), - "Review #{class_name}" => "", -}) %> +<% review_breadcrumbs(@log) %>