From d6c15ffdbfb50550d7a0fb0ba83aaf400bc0e9a8 Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Tue, 30 Jan 2018 14:15:58 -0500 Subject: [PATCH] Add new waffle for modals. --- openedx/features/learner_analytics/__init__.py | 9 +++++++-- themes/edx.org/lms/templates/course_modes/choose.html | 5 ++--- themes/edx.org/lms/templates/dashboard.html | 5 ++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/openedx/features/learner_analytics/__init__.py b/openedx/features/learner_analytics/__init__.py index 51324589cf..a41007a222 100644 --- a/openedx/features/learner_analytics/__init__.py +++ b/openedx/features/learner_analytics/__init__.py @@ -1,10 +1,15 @@ """ Learner analytics helpers and settings """ -from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace - +from openedx.core.djangoapps.waffle_utils import ( + CourseWaffleFlag, WaffleFlag, WaffleFlagNamespace +) # Namespace for learner analytics waffle flags. WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='learner_analytics') +# Simple safety valve in case the modal breaks DOM. +INCLUDE_UPSELL_MODAL = WaffleFlag(WAFFLE_FLAG_NAMESPACE, 'include_upsell_modal') + +# Enables the learner analytics page for different courses via waffle course overrides. ENABLE_DASHBOARD_TAB = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'enable_dashboard_tab') diff --git a/themes/edx.org/lms/templates/course_modes/choose.html b/themes/edx.org/lms/templates/course_modes/choose.html index 6b0fc4f2ef..01db04b35f 100644 --- a/themes/edx.org/lms/templates/course_modes/choose.html +++ b/themes/edx.org/lms/templates/course_modes/choose.html @@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse from opaque_keys.edx.keys import CourseKey from openedx.core.djangolib.js_utils import js_escaped_string from openedx.core.djangolib.markup import HTML, Text -from openedx.features.learner_analytics import ENABLE_DASHBOARD_TAB +from openedx.features.learner_analytics import INCLUDE_UPSELL_MODAL %> <%namespace name='static' file='/static_content.html'/> @@ -85,8 +85,7 @@ from openedx.features.learner_analytics import ENABLE_DASHBOARD_TAB
- <% course_key = CourseKey.from_string('course-v1:Fake+Course+Key') %> - % if ENABLE_DASHBOARD_TAB.is_enabled(course_key): + % if INCLUDE_UPSELL_MODAL.is_enabled(): ${static.renderReact( component="UpsellExperimentModal", id="upsell-modal", diff --git a/themes/edx.org/lms/templates/dashboard.html b/themes/edx.org/lms/templates/dashboard.html index 7d85b2f09c..05f2e3eab0 100644 --- a/themes/edx.org/lms/templates/dashboard.html +++ b/themes/edx.org/lms/templates/dashboard.html @@ -18,7 +18,7 @@ from openedx.core.djangoapps.theming import helpers as theming_helpers from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string from openedx.core.djangolib.markup import HTML, Text -from openedx.features.learner_analytics import ENABLE_DASHBOARD_TAB +from openedx.features.learner_analytics import INCLUDE_UPSELL_MODAL from entitlements.models import CourseEntitlement from student.models import CourseEnrollment @@ -125,8 +125,7 @@ from student.models import CourseEnrollment
- <% course_key = CourseKey.from_string('course-v1:Fake+Course+Key') %> - % if ENABLE_DASHBOARD_TAB.is_enabled(course_key): + % if INCLUDE_UPSELL_MODAL.is_enabled(): ${static.renderReact( component="UpsellExperimentModal", id="upsell-modal",