From 6627f38345bd184971907e0c8cc7dae4bc99bfa8 Mon Sep 17 00:00:00 2001 From: Mat Fish Date: Fri, 18 Nov 2022 17:41:17 +0200 Subject: [PATCH] remove delete button from original + allow editing of original variant name --- CHANGELOG.md | 5 +++++ README.md | 2 +- src/templates/_edit.twig | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8213c33..255677c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Optimum +## 1.0.2 - 2022-11-18 +### Updated +- Remove delete button from original variant row +- Allow for changing the name of the original variant + ## 1.0.1 - 2022-11-17 ### Fixed - Remove CP setting diff --git a/README.md b/README.md index 6781f10..e3966b6 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ An experiment consists of the following fields: 1. In naming the folder for the variants' templates. 2. As the param name, when setting up GA4's custom dimension - **Enabled?** - Weather the experiment is currently active. This can be used to pause or permanently stop the experiment -- **Variants** - The different variants for the experiment. E.g if you are testing different hero banners you would set their reference here. An "original" variant is pre-set and refers to the control group, represented by your current code. It cannot be modified or deleted, other than its weight. +- **Variants** - The different variants for the experiment. E.g if you are testing different hero banners you would set their reference here. An "original" variant is pre-set and refers to the control group, represented by your current code. Its handle cannot be modified, and it cannot be deleted. Each variant comprises three fields: - Name: Human readable name. This will be sent to GA4 as the value (E.g "Wide Banner") - Handle: Used for naming the variant template in twig (E.g "wideBanner) diff --git a/src/templates/_edit.twig b/src/templates/_edit.twig index 17ec812..763476c 100644 --- a/src/templates/_edit.twig +++ b/src/templates/_edit.twig @@ -104,8 +104,10 @@ console.log('rum') const table = $("#variants"); const originalRow = table.find("tr[data-id=0]"); - originalRow.find("td:first-child").find("textarea").prop("readonly",true) + // Disable handle change on original variant originalRow.find("td:nth-child(2)").find("textarea").prop("readonly",true) + // Disable deletion of original row + originalRow.find("td:nth-child(4)").find("button.delete").remove() {% endjs %}