From 9a8d8e12cf5c1a6931a1317eefebe73490f82132 Mon Sep 17 00:00:00 2001 From: alexjanousekGSA Date: Tue, 19 Nov 2024 09:41:08 -0500 Subject: [PATCH 01/10] Added new header button that is displayed in header --- app/__init__.py | 12 ++++++++++++ app/templates/components/header.html | 28 ++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 64580fcc1..43a60abab 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -173,6 +173,18 @@ def inject_feature_flags(): ] return dict(FEATURE_BEST_PRACTICES_ENABLED=feature_best_practices_enabled) + @application.context_processor + def inject_feature_flags(): + feature_best_practices_enabled = application.config[ + "FEATURE_ABOUT_PAGE_ENABLED" + ] + return dict(FEATURE_ABOUT_PAGE_ENABLED=feature_best_practices_enabled) + + @application.context_processor + def inject_initial_signin_url(): + url = os.getenv("LOGIN_DOT_GOV_INITIAL_SIGNIN_URL") + return {'initial_signin_url': url} + notify_environment = os.environ["NOTIFY_ENVIRONMENT"] application.config.from_object(configs[notify_environment]) diff --git a/app/templates/components/header.html b/app/templates/components/header.html index 248abf250..012b3b9c1 100644 --- a/app/templates/components/header.html +++ b/app/templates/components/header.html @@ -43,18 +43,29 @@
-
From 9023943bb1484eb8659359587db4ed3290bb7899 Mon Sep 17 00:00:00 2001 From: alexjanousekGSA Date: Tue, 19 Nov 2024 10:49:30 -0500 Subject: [PATCH 02/10] Fixed a few errors --- app/__init__.py | 17 ++++++----------- app/templates/components/header.html | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 43a60abab..d59ad198b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -168,17 +168,12 @@ def create_app(application): @application.context_processor def inject_feature_flags(): - feature_best_practices_enabled = application.config[ - "FEATURE_BEST_PRACTICES_ENABLED" - ] - return dict(FEATURE_BEST_PRACTICES_ENABLED=feature_best_practices_enabled) - - @application.context_processor - def inject_feature_flags(): - feature_best_practices_enabled = application.config[ - "FEATURE_ABOUT_PAGE_ENABLED" - ] - return dict(FEATURE_ABOUT_PAGE_ENABLED=feature_best_practices_enabled) + feature_best_practices_enabled = application.config.get("FEATURE_BEST_PRACTICES_ENABLED", False) + feature_about_page_enabled = application.config.get("FEATURE_ABOUT_PAGE_ENABLED", False) + return dict( + FEATURE_BEST_PRACTICES_ENABLED=feature_best_practices_enabled, + FEATURE_ABOUT_PAGE_ENABLED=feature_about_page_enabled, + ) @application.context_processor def inject_initial_signin_url(): diff --git a/app/templates/components/header.html b/app/templates/components/header.html index 012b3b9c1..a1c1de389 100644 --- a/app/templates/components/header.html +++ b/app/templates/components/header.html @@ -56,7 +56,7 @@ {% endif %}
- {% if not current_user.is_authenticated and FEATURE_ABOUT_PAGE_ENABLED %} + {% if not current_user.is_authenticated and FEATURE_ABOUT_PAGE_ENABLED and request.path == '/about'%}