From 069c9b3f7a14104af6a32f74896eea1d494aed26 Mon Sep 17 00:00:00 2001
From: Phil Reese <preese@fearless.tech>
Date: Thu, 17 Oct 2024 12:30:03 -0400
Subject: [PATCH] EREGCSC-2865 -- Update demo video information on homepage
 (#1445)

* feat: add DEMO_VIDEO_URL where needed

* format: add spacing to please Ruff linter

* chore: add DEMO_VIDEO_URL to serverless experimental yml

* feat: update video link image label and alt text

* feat: use CMSHHVgov official YouTube page as fallback video link
---
 solution/backend/cmcs_regulations/context_processors.py     | 6 ++++++
 solution/backend/cmcs_regulations/settings/base.py          | 5 +++++
 .../backend/regulations/templates/regulations/homepage.html | 6 +++---
 solution/backend/serverless-experimental.yml                | 1 +
 solution/backend/serverless.yml                             | 1 +
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/solution/backend/cmcs_regulations/context_processors.py b/solution/backend/cmcs_regulations/context_processors.py
index 77b07f151c..87cd36664e 100644
--- a/solution/backend/cmcs_regulations/context_processors.py
+++ b/solution/backend/cmcs_regulations/context_processors.py
@@ -30,6 +30,12 @@ def survey_url(request):
     }
 
 
+def demo_video_url(request):
+    return {
+        "DEMO_VIDEO_URL": settings.DEMO_VIDEO_URL
+    }
+
+
 def signup_url(request):
     return {
         "SIGNUP_URL": settings.SIGNUP_URL
diff --git a/solution/backend/cmcs_regulations/settings/base.py b/solution/backend/cmcs_regulations/settings/base.py
index 49f1ab348c..01f9fea818 100644
--- a/solution/backend/cmcs_regulations/settings/base.py
+++ b/solution/backend/cmcs_regulations/settings/base.py
@@ -153,6 +153,7 @@
                 "cmcs_regulations.context_processors.custom_url",
                 "cmcs_regulations.context_processors.survey_url",
                 "cmcs_regulations.context_processors.signup_url",
+                "cmcs_regulations.context_processors.demo_video_url",
                 "cmcs_regulations.context_processors.deploy_number",
                 "cmcs_regulations.context_processors.automated_testing",
                 'cmcs_regulations.context_processors.api_base',
@@ -225,6 +226,10 @@
     "SIGNUP_URL",
     "https://docs.google.com/forms/d/e/1FAIpQLSdcG9mfTz6Kebdni8YSacl27rIwpGy2a7GsMGO0kb_T7FSNxg/viewform?embedded=true"
 )
+DEMO_VIDEO_URL = os.environ.get(
+    "DEMO_VIDEO_URL",
+    "https://www.youtube.com/@CMSHHSgov"
+)
 
 DEPLOY_NUMBER = os.environ.get("DEPLOY_NUMBER", datetime.now())
 
diff --git a/solution/backend/regulations/templates/regulations/homepage.html b/solution/backend/regulations/templates/regulations/homepage.html
index 48f594082a..663ffa257d 100644
--- a/solution/backend/regulations/templates/regulations/homepage.html
+++ b/solution/backend/regulations/templates/regulations/homepage.html
@@ -31,16 +31,16 @@
                 <div class="cta">
                     <div class="video__container">
                         <a
-                            href="https://www.youtube.com/watch?v=dqy8WCFedU4"
+                            href="{{ DEMO_VIDEO_URL }}"
                             target="_blank"
                             rel="noopener noreferrer"
                         >
                             <img
                                 src="{% static 'images/home_video.png' %}"
-                                alt="View a 6-minute video demonstration."
+                                alt="View an 8-minute video demonstration."
                             />
                         </a>
-                        <label id="videoLabel">View a 6-minute video demonstration.</label>
+                        <label id="videoLabel">View an 8-minute video demonstration.</label>
                     </div>
                     <div class="about-text__container">
                         <p>
diff --git a/solution/backend/serverless-experimental.yml b/solution/backend/serverless-experimental.yml
index 58d1c01cdb..74ab6c7e8d 100644
--- a/solution/backend/serverless-experimental.yml
+++ b/solution/backend/serverless-experimental.yml
@@ -37,6 +37,7 @@ provider:
     CUSTOM_URL: ${ssm:/eregulations/custom_url, ''}
     SURVEY_URL: ${ssm:/eregulations/survey_url}
     SIGNUP_URL: ${ssm:/eregulations/signup_url}
+    DEMO_VIDEO_URL: ${ssm:/eregulations/demo_video_url}
     AWS_STORAGE_BUCKET_NAME: file-repo-eregs-${self:custom.stage}
     OIDC_OP_JWKS_ENDPOINT: ${ssm:/eregulations/oidc/jwks_endpoint}
     OIDC_RP_CLIENT_ID: ${ssm:/eregulations/oidc/client_id}
diff --git a/solution/backend/serverless.yml b/solution/backend/serverless.yml
index da4480a773..6b4ca9ffa4 100644
--- a/solution/backend/serverless.yml
+++ b/solution/backend/serverless.yml
@@ -39,6 +39,7 @@ provider:
     CUSTOM_URL: ${ssm:/eregulations/custom_url}
     SURVEY_URL: ${ssm:/eregulations/survey_url}
     SIGNUP_URL: ${ssm:/eregulations/signup_url}
+    DEMO_VIDEO_URL: ${ssm:/eregulations/demo_video_url}
     OIDC_RP_CLIENT_ID:  ${ssm:/eregulations/oidc/client_id}
     OIDC_RP_CLIENT_SECRET: ${ssm:/eregulations/oidc/client_secret}
     OIDC_OP_AUTHORIZATION_ENDPOINT: ${ssm:/eregulations/oidc/authorization_endpoint}