From fa4967332169d8f4019510f911471a813d6e4286 Mon Sep 17 00:00:00 2001 From: Chris Gannon Date: Tue, 17 Oct 2023 12:43:57 +0100 Subject: [PATCH] remove editable fields for ingredients --- .../notifications/_product_details.html.erb | 72 +++++++++++-------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/cosmetics-web/app/views/responsible_persons/notifications/_product_details.html.erb b/cosmetics-web/app/views/responsible_persons/notifications/_product_details.html.erb index 98f93513ab..c657312a83 100644 --- a/cosmetics-web/app/views/responsible_persons/notifications/_product_details.html.erb +++ b/cosmetics-web/app/views/responsible_persons/notifications/_product_details.html.erb @@ -41,36 +41,50 @@ value: { text: get_notification_type_name(component.notification_type) }, }, if component.predefined? - { - key: { text: "Frame formulation" }, - value: { text: get_frame_formulation_name(component.frame_formulation) }, - actions: { - items: [ - { - href: responsible_person_notification_product_path(notification.responsible_person, notification, :add_product_image), - text: "Edit", - visuallyHiddenText: "product image", - classes: ["govuk-link--no-visited-state"] - } - ] - }, - } + if component.notification.editable? + { + key: { text: "Frame formulation" }, + value: { text: get_frame_formulation_name(component.frame_formulation) }, + actions: { + items: [ + { + href: responsible_person_notification_component_build_path(component.notification.responsible_person, component.notification, component, :select_frame_formulation), + text: "Edit", + visuallyHiddenText: "frame formulation", + classes: ["govuk-link--no-visited-state"] + } + ] + }, + } + else + { + key: { text: "Frame formulation" }, + value: { text: get_frame_formulation_name(component.frame_formulation) }, + } + end elsif component.formulation_file.attached? - { - key: { text: "Formulation" }, - value: { html: render("notifications/component_details_formulation_ingredients", - component: component) }, - actions: { - items: [ - { - href: responsible_person_notification_product_path(notification.responsible_person, notification, :add_product_image), - text: "Edit", - visuallyHiddenText: "product image", - classes: ["govuk-link--no-visited-state"] - } - ] - }, - } + if component.notification.editable? + { + key: { text: "Formulation" }, + value: { html: render("notifications/component_details_formulation_ingredients", + component: component) }, + actions: { + items: [ + { + href: responsible_person_notification_component_build_path(component.notification.responsible_person, component.notification, component, :upload_ingredients_file), + text: "Edit", + visuallyHiddenText: "formulation", + classes: ["govuk-link--no-visited-state"] + } + ] + }, + } + else + { + key: { text: "Formulation" }, + value: { html: render("notifications/component_details_formulation_ingredients", component: component) }, + } + end end ].compact ) %>