Commit b575d50a by Matt Drayer

Merge pull request #11287 from edx/ziafazal/WL-287

ziafazal/WL-287: moved IS_EDX_DOMAIN dependent features to edx.org theme
parents e851db58 c0648ab1
...@@ -136,12 +136,6 @@ FEATURES = { ...@@ -136,12 +136,6 @@ FEATURES = {
# Turn off Video Upload Pipeline through Studio, by default # Turn off Video Upload Pipeline through Studio, by default
'ENABLE_VIDEO_UPLOAD_PIPELINE': False, 'ENABLE_VIDEO_UPLOAD_PIPELINE': False,
# Is this an edX-owned domain? (edx.org)
# for consistency in user-experience, keep the value of this feature flag
# in sync with the one in lms/envs/common.py
'IS_EDX_DOMAIN': False,
# let students save and manage their annotations # let students save and manage their annotations
# for consistency in user-experience, keep the value of this feature flag # for consistency in user-experience, keep the value of this feature flag
# in sync with the one in lms/envs/common.py # in sync with the one in lms/envs/common.py
......
...@@ -23,7 +23,6 @@ from django.core.urlresolvers import reverse ...@@ -23,7 +23,6 @@ from django.core.urlresolvers import reverse
<%! <%!
from django.conf import settings from django.conf import settings
is_edx_domain = settings.FEATURES.get('IS_EDX_DOMAIN', False)
partner_email = settings.FEATURES.get('PARTNER_SUPPORT_EMAIL', '') partner_email = settings.FEATURES.get('PARTNER_SUPPORT_EMAIL', '')
links = [{ links = [{
...@@ -32,15 +31,10 @@ from django.core.urlresolvers import reverse ...@@ -32,15 +31,10 @@ from django.core.urlresolvers import reverse
'text': _('edX Documentation'), 'text': _('edX Documentation'),
'condition': True 'condition': True
}, { }, {
'href': 'https://partners.edx.org',
'sr_mouseover_text': _('Access Course Staff Support on the Partner Portal to submit or review support tickets'),
'text': _('edX Partner Portal'),
'condition': is_edx_domain
}, {
'href': 'https://open.edx.org', 'href': 'https://open.edx.org',
'sr_mouseover_text': _('Access the Open edX Portal'), 'sr_mouseover_text': _('Access the Open edX Portal'),
'text': _('Open edX Portal'), 'text': _('Open edX Portal'),
'condition': not is_edx_domain 'condition': True
}, { }, {
'href': 'https://www.edx.org/course/overview-creating-edx-course-edx-edx101#.VO4eaLPF-n1', 'href': 'https://www.edx.org/course/overview-creating-edx-course-edx-edx101#.VO4eaLPF-n1',
'sr_mouseover_text': _('Enroll in edX101: Overview of Creating an edX Course'), 'sr_mouseover_text': _('Enroll in edX101: Overview of Creating an edX Course'),
......
...@@ -14,6 +14,7 @@ from course_modes.tests.factories import CourseModeFactory ...@@ -14,6 +14,7 @@ from course_modes.tests.factories import CourseModeFactory
from student.tests.factories import CourseEnrollmentFactory, UserFactory from student.tests.factories import CourseEnrollmentFactory, UserFactory
from student.models import CourseEnrollment from student.models import CourseEnrollment
from course_modes.models import CourseMode, Mode from course_modes.models import CourseMode, Mode
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
@ddt.ddt @ddt.ddt
...@@ -324,7 +325,7 @@ class CourseModeViewTest(UrlResetMixin, ModuleStoreTestCase): ...@@ -324,7 +325,7 @@ class CourseModeViewTest(UrlResetMixin, ModuleStoreTestCase):
self.assertEquals(course_modes, expected_modes) self.assertEquals(course_modes, expected_modes)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@patch.dict(settings.FEATURES, {"IS_EDX_DOMAIN": True}) @with_is_edx_domain(True)
def test_hide_nav(self): def test_hide_nav(self):
# Create the course modes # Create the course modes
for mode in ["honor", "verified"]: for mode in ["honor", "verified"]:
......
...@@ -101,17 +101,6 @@ def marketing_link_context_processor(request): ...@@ -101,17 +101,6 @@ def marketing_link_context_processor(request):
) )
def open_source_footer_context_processor(request):
"""
Checks the site name to determine whether to use the edX.org footer or the Open Source Footer.
"""
return dict(
[
("IS_EDX_DOMAIN", settings.FEATURES.get('IS_EDX_DOMAIN', False))
]
)
def microsite_footer_context_processor(request): def microsite_footer_context_processor(request):
""" """
Checks the site name to determine whether to use the edX.org footer or the Open Source Footer. Checks the site name to determine whether to use the edX.org footer or the Open Source Footer.
......
...@@ -17,7 +17,6 @@ from edxmako.shortcuts import ( ...@@ -17,7 +17,6 @@ from edxmako.shortcuts import (
is_marketing_link_set, is_marketing_link_set,
is_any_marketing_link_set, is_any_marketing_link_set,
render_to_string, render_to_string,
open_source_footer_context_processor
) )
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from util.testing import UrlResetMixin from util.testing import UrlResetMixin
...@@ -69,15 +68,6 @@ class ShortcutsTests(UrlResetMixin, TestCase): ...@@ -69,15 +68,6 @@ class ShortcutsTests(UrlResetMixin, TestCase):
self.assertTrue(is_any_marketing_link_set(['ABOUT', 'NOT_CONFIGURED'])) self.assertTrue(is_any_marketing_link_set(['ABOUT', 'NOT_CONFIGURED']))
self.assertFalse(is_any_marketing_link_set(['NOT_CONFIGURED'])) self.assertFalse(is_any_marketing_link_set(['NOT_CONFIGURED']))
@ddt.data((True, None), (False, None))
@ddt.unpack
def test_edx_footer(self, expected_result, _):
with patch.dict('django.conf.settings.FEATURES', {
'IS_EDX_DOMAIN': expected_result
}):
result = open_source_footer_context_processor({})
self.assertEquals(expected_result, result.get('IS_EDX_DOMAIN'))
class AddLookupTests(TestCase): class AddLookupTests(TestCase):
""" """
......
...@@ -22,6 +22,7 @@ from edxmako.shortcuts import render_to_string ...@@ -22,6 +22,7 @@ from edxmako.shortcuts import render_to_string
from edxmako.tests import mako_middleware_process_request from edxmako.tests import mako_middleware_process_request
from util.request import safe_get_host from util.request import safe_get_host
from util.testing import EventTestMixin from util.testing import EventTestMixin
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
class TestException(Exception): class TestException(Exception):
...@@ -99,7 +100,7 @@ class ActivationEmailTests(TestCase): ...@@ -99,7 +100,7 @@ class ActivationEmailTests(TestCase):
self._create_account() self._create_account()
self._assert_activation_email(self.ACTIVATION_SUBJECT, self.OPENEDX_FRAGMENTS) self._assert_activation_email(self.ACTIVATION_SUBJECT, self.OPENEDX_FRAGMENTS)
@patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': True}) @with_is_edx_domain(True)
def test_activation_email_edx_domain(self): def test_activation_email_edx_domain(self):
self._create_account() self._create_account()
self._assert_activation_email(self.ACTIVATION_SUBJECT, self.EDX_DOMAIN_FRAGMENTS) self._assert_activation_email(self.ACTIVATION_SUBJECT, self.EDX_DOMAIN_FRAGMENTS)
......
...@@ -44,6 +44,7 @@ from certificates.tests.factories import GeneratedCertificateFactory # pylint: ...@@ -44,6 +44,7 @@ from certificates.tests.factories import GeneratedCertificateFactory # pylint:
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
import shoppingcart # pylint: disable=import-error import shoppingcart # pylint: disable=import-error
from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
# Explicitly import the cache from ConfigurationModel so we can reset it after each test # Explicitly import the cache from ConfigurationModel so we can reset it after each test
from config_models.models import cache from config_models.models import cache
...@@ -491,7 +492,7 @@ class DashboardTest(ModuleStoreTestCase): ...@@ -491,7 +492,7 @@ class DashboardTest(ModuleStoreTestCase):
self.assertEquals(response_2.status_code, 200) self.assertEquals(response_2.status_code, 200)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@patch.dict(settings.FEATURES, {"IS_EDX_DOMAIN": True}) @with_is_edx_domain(True)
def test_dashboard_header_nav_has_find_courses(self): def test_dashboard_header_nav_has_find_courses(self):
self.client.login(username="jack", password="test") self.client.login(username="jack", password="test")
response = self.client.get(reverse("dashboard")) response = self.client.get(reverse("dashboard"))
......
...@@ -111,18 +111,13 @@ def _footer_copyright(): ...@@ -111,18 +111,13 @@ def _footer_copyright():
Returns: unicode Returns: unicode
""" """
org_name = (
"edX Inc" if settings.FEATURES.get('IS_EDX_DOMAIN', False)
else microsite.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)
return _( return _(
# Translators: 'EdX', 'edX', and 'Open edX' are trademarks of 'edX Inc.'. # Translators: 'EdX', 'edX', and 'Open edX' are trademarks of 'edX Inc.'.
# Please do not translate any of these trademarks and company names. # Please do not translate any of these trademarks and company names.
u"\u00A9 {org_name}. All rights reserved except where noted. " u"\u00A9 {org_name}. All rights reserved except where noted. "
u"EdX, Open edX and the edX and Open EdX logos are registered trademarks " u"EdX, Open edX and the edX and Open EdX logos are registered trademarks "
u"or trademarks of edX Inc." u"or trademarks of edX Inc."
).format(org_name=org_name) ).format(org_name=microsite.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))
def _footer_openedx_link(): def _footer_openedx_link():
...@@ -389,9 +384,7 @@ def get_logo_url(): ...@@ -389,9 +384,7 @@ def get_logo_url():
# otherwise, use the legacy means to configure this # otherwise, use the legacy means to configure this
university = microsite.get_value('university') university = microsite.get_value('university')
if university is None and settings.FEATURES.get('IS_EDX_DOMAIN', False): if university:
return staticfiles_storage.url('images/edx-theme/edx-logo-77x36.png')
elif university:
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university)) return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
else: else:
return staticfiles_storage.url('images/logo.png') return staticfiles_storage.url('images/logo.png')
......
# encoding: utf-8 # encoding: utf-8
"""Tests of Branding API views. """ """Tests of Branding API views. """
import contextlib
import json import json
import urllib import urllib
from django.test import TestCase from django.test import TestCase
...@@ -11,6 +10,7 @@ import mock ...@@ -11,6 +10,7 @@ import mock
import ddt import ddt
from config_models.models import cache from config_models.models import cache
from branding.models import BrandingApiConfig from branding.models import BrandingApiConfig
from openedx.core.djangoapps.theming.test_util import with_edx_domain_context
@ddt.ddt @ddt.ddt
...@@ -42,7 +42,7 @@ class TestFooter(TestCase): ...@@ -42,7 +42,7 @@ class TestFooter(TestCase):
@ddt.unpack @ddt.unpack
def test_footer_content_types(self, is_edx_domain, accepts, content_type, content): def test_footer_content_types(self, is_edx_domain, accepts, content_type, content):
self._set_feature_flag(True) self._set_feature_flag(True)
with self._set_is_edx_domain(is_edx_domain): with with_edx_domain_context(is_edx_domain):
resp = self._get_footer(accepts=accepts) resp = self._get_footer(accepts=accepts)
self.assertEqual(resp.status_code, 200) self.assertEqual(resp.status_code, 200)
...@@ -53,7 +53,7 @@ class TestFooter(TestCase): ...@@ -53,7 +53,7 @@ class TestFooter(TestCase):
@ddt.data(True, False) @ddt.data(True, False)
def test_footer_json(self, is_edx_domain): def test_footer_json(self, is_edx_domain):
self._set_feature_flag(True) self._set_feature_flag(True)
with self._set_is_edx_domain(is_edx_domain): with with_edx_domain_context(is_edx_domain):
resp = self._get_footer() resp = self._get_footer()
self.assertEqual(resp.status_code, 200) self.assertEqual(resp.status_code, 200)
...@@ -153,7 +153,7 @@ class TestFooter(TestCase): ...@@ -153,7 +153,7 @@ class TestFooter(TestCase):
def test_language_rtl(self, is_edx_domain, language, static_path): def test_language_rtl(self, is_edx_domain, language, static_path):
self._set_feature_flag(True) self._set_feature_flag(True)
with self._set_is_edx_domain(is_edx_domain): with with_edx_domain_context(is_edx_domain):
resp = self._get_footer(accepts="text/html", params={'language': language}) resp = self._get_footer(accepts="text/html", params={'language': language})
self.assertEqual(resp.status_code, 200) self.assertEqual(resp.status_code, 200)
...@@ -172,7 +172,7 @@ class TestFooter(TestCase): ...@@ -172,7 +172,7 @@ class TestFooter(TestCase):
def test_show_openedx_logo(self, is_edx_domain, show_logo): def test_show_openedx_logo(self, is_edx_domain, show_logo):
self._set_feature_flag(True) self._set_feature_flag(True)
with self._set_is_edx_domain(is_edx_domain): with with_edx_domain_context(is_edx_domain):
params = {'show-openedx-logo': 1} if show_logo else {} params = {'show-openedx-logo': 1} if show_logo else {}
resp = self._get_footer(accepts="text/html", params=params) resp = self._get_footer(accepts="text/html", params=params)
...@@ -195,7 +195,7 @@ class TestFooter(TestCase): ...@@ -195,7 +195,7 @@ class TestFooter(TestCase):
@ddt.unpack @ddt.unpack
def test_include_dependencies(self, is_edx_domain, include_dependencies): def test_include_dependencies(self, is_edx_domain, include_dependencies):
self._set_feature_flag(True) self._set_feature_flag(True)
with self._set_is_edx_domain(is_edx_domain): with with_edx_domain_context(is_edx_domain):
params = {'include-dependencies': 1} if include_dependencies else {} params = {'include-dependencies': 1} if include_dependencies else {}
resp = self._get_footer(accepts="text/html", params=params) resp = self._get_footer(accepts="text/html", params=params)
...@@ -227,9 +227,3 @@ class TestFooter(TestCase): ...@@ -227,9 +227,3 @@ class TestFooter(TestCase):
) )
return self.client.get(url, HTTP_ACCEPT=accepts) return self.client.get(url, HTTP_ACCEPT=accepts)
@contextlib.contextmanager
def _set_is_edx_domain(self, is_edx_domain):
"""Configure whether this an EdX-controlled domain. """
with mock.patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': is_edx_domain}):
yield
...@@ -148,8 +148,7 @@ def _render_footer_html(request, show_openedx_logo, include_dependencies): ...@@ -148,8 +148,7 @@ def _render_footer_html(request, show_openedx_logo, include_dependencies):
""" """
bidi = 'rtl' if translation.get_language_bidi() else 'ltr' bidi = 'rtl' if translation.get_language_bidi() else 'ltr'
version = 'edx' if settings.FEATURES.get('IS_EDX_DOMAIN') else 'openedx' css_name = settings.FOOTER_CSS['openedx'][bidi]
css_name = settings.FOOTER_CSS[version][bidi]
context = { context = {
'hide_openedx_link': not show_openedx_logo, 'hide_openedx_link': not show_openedx_logo,
...@@ -159,11 +158,7 @@ def _render_footer_html(request, show_openedx_logo, include_dependencies): ...@@ -159,11 +158,7 @@ def _render_footer_html(request, show_openedx_logo, include_dependencies):
'include_dependencies': include_dependencies, 'include_dependencies': include_dependencies,
} }
return ( return render_to_response("footer.html", context)
render_to_response("footer-edx-v3.html", context)
if settings.FEATURES.get("IS_EDX_DOMAIN", False)
else render_to_response("footer.html", context)
)
@cache_control(must_revalidate=True, max_age=settings.FOOTER_BROWSER_CACHE_MAX_AGE) @cache_control(must_revalidate=True, max_age=settings.FOOTER_BROWSER_CACHE_MAX_AGE)
......
...@@ -10,6 +10,7 @@ from django.test import TestCase ...@@ -10,6 +10,7 @@ from django.test import TestCase
import mock import mock
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
class UserMixin(object): class UserMixin(object):
...@@ -86,7 +87,7 @@ class ReceiptViewTests(UserMixin, TestCase): ...@@ -86,7 +87,7 @@ class ReceiptViewTests(UserMixin, TestCase):
self.assertRegexpMatches(response.content, user_message if is_user_message_expected else system_message) self.assertRegexpMatches(response.content, user_message if is_user_message_expected else system_message)
self.assertNotRegexpMatches(response.content, user_message if not is_user_message_expected else system_message) self.assertNotRegexpMatches(response.content, user_message if not is_user_message_expected else system_message)
@mock.patch.dict(settings.FEATURES, {"IS_EDX_DOMAIN": True}) @with_is_edx_domain(True)
def test_hide_nav_header(self): def test_hide_nav_header(self):
self._login() self._login()
post_data = {'decision': 'ACCEPT', 'reason_code': '200', 'signed_field_names': 'dummy'} post_data = {'decision': 'ACCEPT', 'reason_code': '200', 'signed_field_names': 'dummy'}
......
...@@ -26,6 +26,7 @@ from student_account.views import account_settings_context ...@@ -26,6 +26,7 @@ from student_account.views import account_settings_context
from third_party_auth.tests.testutil import simulate_running_pipeline, ThirdPartyAuthTestMixin from third_party_auth.tests.testutil import simulate_running_pipeline, ThirdPartyAuthTestMixin
from util.testing import UrlResetMixin from util.testing import UrlResetMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from openedx.core.djangoapps.theming.test_util import with_edx_domain_context
@ddt.ddt @ddt.ddt
...@@ -254,7 +255,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -254,7 +255,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
# The response should have a "Sign In" button with the URL # The response should have a "Sign In" button with the URL
# that preserves the querystring params # that preserves the querystring params
with mock.patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': is_edx_domain}): with with_edx_domain_context(is_edx_domain):
response = self.client.get(reverse(url_name), params) response = self.client.get(reverse(url_name), params)
expected_url = '/login?{}'.format(self._finish_auth_url_param(params + [('next', '/dashboard')])) expected_url = '/login?{}'.format(self._finish_auth_url_param(params + [('next', '/dashboard')]))
...@@ -270,7 +271,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -270,7 +271,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
] ]
# Verify that this parameter is also preserved # Verify that this parameter is also preserved
with mock.patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': is_edx_domain}): with with_edx_domain_context(is_edx_domain):
response = self.client.get(reverse(url_name), params) response = self.client.get(reverse(url_name), params)
expected_url = '/login?{}'.format(self._finish_auth_url_param(params)) expected_url = '/login?{}'.format(self._finish_auth_url_param(params))
......
...@@ -37,6 +37,7 @@ from common.test.utils import XssTestMixin ...@@ -37,6 +37,7 @@ from common.test.utils import XssTestMixin
from commerce.tests import TEST_PAYMENT_DATA, TEST_API_URL, TEST_API_SIGNING_KEY from commerce.tests import TEST_PAYMENT_DATA, TEST_API_URL, TEST_API_SIGNING_KEY
from embargo.test_utils import restrict_course from embargo.test_utils import restrict_course
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
from shoppingcart.models import Order, CertificateItem from shoppingcart.models import Order, CertificateItem
from student.tests.factories import UserFactory, CourseEnrollmentFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory
from student.models import CourseEnrollment from student.models import CourseEnrollment
...@@ -282,7 +283,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin): ...@@ -282,7 +283,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin):
) )
self._assert_redirects_to_dashboard(response) self._assert_redirects_to_dashboard(response)
@patch.dict(settings.FEATURES, {"IS_EDX_DOMAIN": True}) @with_is_edx_domain(True)
@ddt.data("verify_student_start_flow", "verify_student_begin_flow") @ddt.data("verify_student_start_flow", "verify_student_begin_flow")
def test_pay_and_verify_hides_header_nav(self, payment_flow): def test_pay_and_verify_hides_header_nav(self, payment_flow):
course = self._create_course("verified") course = self._create_course("verified")
......
...@@ -180,9 +180,6 @@ FEATURES = { ...@@ -180,9 +180,6 @@ FEATURES = {
# Enable Custom Courses for EdX # Enable Custom Courses for EdX
'CUSTOM_COURSES_EDX': False, 'CUSTOM_COURSES_EDX': False,
# Is this an edX-owned domain? (used for edX specific messaging and images)
'IS_EDX_DOMAIN': False,
# Toggle to enable certificates of courses on dashboard # Toggle to enable certificates of courses on dashboard
'ENABLE_VERIFIED_CERTIFICATES': False, 'ENABLE_VERIFIED_CERTIFICATES': False,
...@@ -496,9 +493,6 @@ TEMPLATES = [ ...@@ -496,9 +493,6 @@ TEMPLATES = [
# Hack to get required link URLs to password reset templates # Hack to get required link URLs to password reset templates
'edxmako.shortcuts.marketing_link_context_processor', 'edxmako.shortcuts.marketing_link_context_processor',
# Allows the open edX footer to be leveraged in Django Templates.
'edxmako.shortcuts.open_source_footer_context_processor',
# Shoppingcart processor (detects if request.user has a cart) # Shoppingcart processor (detects if request.user has a cart)
'shoppingcart.context_processor.user_has_cart_context_processor', 'shoppingcart.context_processor.user_has_cart_context_processor',
......
...@@ -29,7 +29,6 @@ FEATURES['MULTIPLE_ENROLLMENT_ROLES'] = True ...@@ -29,7 +29,6 @@ FEATURES['MULTIPLE_ENROLLMENT_ROLES'] = True
FEATURES['ENABLE_SHOPPING_CART'] = True FEATURES['ENABLE_SHOPPING_CART'] = True
FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = True
FEATURES['ENABLE_S3_GRADE_DOWNLOADS'] = True FEATURES['ENABLE_S3_GRADE_DOWNLOADS'] = True
FEATURES['IS_EDX_DOMAIN'] = True # Is this an edX-owned domain? (used on instructor dashboard)
FEATURES['ENABLE_PAYMENT_FAKE'] = True FEATURES['ENABLE_PAYMENT_FAKE'] = True
......
...@@ -151,13 +151,6 @@ import json ...@@ -151,13 +151,6 @@ import json
<section id="dashboard-search-results" class="search-results dashboard-search-results"></section> <section id="dashboard-search-results" class="search-results dashboard-search-results"></section>
% endif % endif
% if settings.FEATURES.get('IS_EDX_DOMAIN') and settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<div class="wrapper-find-courses">
<p class="copy">${_("Check out our recently launched courses and what's new in your favorite subjects")}</p>
<p><a class="btn-find-courses" href="${marketing_link('COURSES')}">${_("Find New Courses")}</a></p>
</div>
% endif
<section class="profile-sidebar" id="profile-sidebar" role="region" aria-label="Account Status Info"> <section class="profile-sidebar" id="profile-sidebar" role="region" aria-label="Account Status Info">
<header class="profile"> <header class="profile">
<h2 class="account-status-title sr">${_("Account Status Info")}: </h2> <h2 class="account-status-title sr">${_("Account Status Info")}: </h2>
......
...@@ -14,37 +14,7 @@ ${_("Change your life and start learning today by activating your " ...@@ -14,37 +14,7 @@ ${_("Change your life and start learning today by activating your "
http://${ site }/activate/${ key } http://${ site }/activate/${ key }
% endif % endif
% if settings.FEATURES.get('IS_EDX_DOMAIN'): % if stanford_theme_enabled(): ## Temporary hack until we develop a better way to adjust language
${_("After you activate your account, you can sign up for "
"and take any of the hundreds of courses {platform_name} offers."
).format(platform_name=settings.PLATFORM_NAME)}
${_("Once you have activated your account, edX will send you email "
"from time to time about new courses or other information.")}
${_("If you need help, please use our web form at "
"{contact_us_url}, email {info_email_address}, "
"or write to {info_postal_address}."
).format(
contact_us_url="https://www.edx.org/contact-us",
info_email_address=settings.CONTACT_EMAIL,
info_postal_address=settings.CONTACT_MAILING_ADDRESS
)}
${_("We hope you enjoy learning with {platform_name}!").format(
platform_name=settings.PLATFORM_NAME
)}
${_("The {platform_name} Team").format(platform_name=settings.PLATFORM_NAME)}
${_("This email was automatically sent by {site_name} because someone "
"attempted to create an {platform_name} account using this email address."
).format(
site_name=settings.SITE_NAME,
platform_name=settings.PLATFORM_NAME
)}
% elif stanford_theme_enabled(): ## Temporary hack until we develop a better way to adjust language
${_("If you didn't request this, you don't need to do anything; you won't " ${_("If you didn't request this, you don't need to do anything; you won't "
"receive any more email from us. Please do not reply to this e-mail; " "receive any more email from us. Please do not reply to this e-mail; "
"if you require assistance, check the about section of the " "if you require assistance, check the about section of the "
......
## mako
<%!
from django.utils.translation import ugettext as _
from branding.api import get_footer
%>
<% footer = get_footer(is_secure=is_secure) %>
<%namespace name='static' file='static_content.html'/>
## WARNING: These files are specific to edx.org and are not used in installations outside of that domain. Open edX users will want to use the file "footer.html" for any changes or overrides.
<footer id="footer-edx-v3" role="contentinfo" aria-label="${_("Page Footer")}"
## When rendering the footer through the branding API,
## the direction may not be set on the parent element,
## so we set it here.
% if bidi:
dir=${bidi}
% endif
>
<h2 class="sr footer-about-title">${_("About edX")}</h2>
<div class="footer-content-wrapper">
<div class="footer-logo">
<img alt="edX logo" src="${footer['logo_image']}">
</div>
<div class="site-details">
<nav class="site-nav" aria-label="${_("About edX")}">
% for link in footer["navigation_links"]:
<a href="${link['url']}">${link['title']}</a>
% endfor
</nav>
<nav class="legal-notices" aria-label="${_("Legal")}">
% for link in footer["legal_links"]:
<a href="${link['url']}">${link['title']}</a>
% endfor
</nav>
<p class="copyright">${footer['copyright']}</p>
## The OpenEdX link may be hidden when this view is served
## through an API to partner sites (such as marketing sites or blogs),
## which are not technically powered by OpenEdX.
% if not hide_openedx_link:
<div class="openedx-link">
<a href="${footer['openedx_link']['url']}" title="${footer['openedx_link']['title']}">
<img alt="${footer['openedx_link']['title']}" src="${footer['openedx_link']['image']}" width="140">
</a>
</div>
% endif
</div>
<div class="external-links">
<div class="social-media-links">
% for link in footer['social_links']:
<a href="${link['url']}" class="sm-link external" title="${link['title']}" rel="noreferrer">
<span class="icon fa ${link['icon-class']}" aria-hidden="true"></span>
<span class="sr">${link['action']}</span>
</a>
% endfor
</div>
<div class="mobile-app-links">
% for link in footer['mobile_links']:
<a href="${link['url']}" class="app-link external">
<img alt="${link['title']}" src="${link['image']}">
</a>
% endfor
</div>
</div>
</div>
</footer>
% if include_dependencies:
<%static:js group='base_vendor'/>
<%static:css group='style-vendor'/>
<%include file="widgets/segment-io.html" />
<%include file="widgets/segment-io-footer.html" />
% endif
% if footer_css_urls:
% for url in footer_css_urls:
<link rel="stylesheet" type="text/css" href="${url}"></link>
% endfor
% endif
% if footer_js_url:
<script type="text/javascript" src="${footer_js_url}"></script>
% endif
...@@ -5,6 +5,7 @@ Test helpers for Comprehensive Theming. ...@@ -5,6 +5,7 @@ Test helpers for Comprehensive Theming.
from functools import wraps from functools import wraps
import os import os
import os.path import os.path
import contextlib
from mock import patch from mock import patch
...@@ -15,6 +16,8 @@ import edxmako ...@@ -15,6 +16,8 @@ import edxmako
from .core import comprehensive_theme_changes from .core import comprehensive_theme_changes
EDX_THEME_DIR = settings.REPO_ROOT / "themes" / "edx.org"
def with_comprehensive_theme(theme_dir): def with_comprehensive_theme(theme_dir):
""" """
...@@ -46,11 +49,7 @@ def with_comprehensive_theme(theme_dir): ...@@ -46,11 +49,7 @@ def with_comprehensive_theme(theme_dir):
def with_is_edx_domain(is_edx_domain): def with_is_edx_domain(is_edx_domain):
""" """
A decorator to run a test as if IS_EDX_DOMAIN is true or false. A decorator to run a test as if request originated from edX domain or not.
We are transitioning away from IS_EDX_DOMAIN and are moving toward an edX
theme. This decorator changes both settings to let tests stay isolated
from the details.
Arguments: Arguments:
is_edx_domain (bool): are we an edX domain or not? is_edx_domain (bool): are we an edX domain or not?
...@@ -61,16 +60,34 @@ def with_is_edx_domain(is_edx_domain): ...@@ -61,16 +60,34 @@ def with_is_edx_domain(is_edx_domain):
def _decorator(func): # pylint: disable=missing-docstring def _decorator(func): # pylint: disable=missing-docstring
if is_edx_domain: if is_edx_domain:
# This applies @with_comprehensive_theme to the func. # This applies @with_comprehensive_theme to the func.
func = with_comprehensive_theme(settings.REPO_ROOT / "themes" / "edx.org")(func) func = with_comprehensive_theme(EDX_THEME_DIR)(func)
# This applies @patch.dict() to the func to set IS_EDX_DOMAIN.
func = patch.dict('django.conf.settings.FEATURES', {"IS_EDX_DOMAIN": is_edx_domain})(func)
return func return func
return _decorator return _decorator
@contextlib.contextmanager
def with_edx_domain_context(is_edx_domain):
"""
A function to run a test as if request originated from edX domain or not.
Arguments:
is_edx_domain (bool): are we an edX domain or not?
"""
if is_edx_domain:
changes = comprehensive_theme_changes(EDX_THEME_DIR)
with override_settings(COMPREHENSIVE_THEME_DIR=EDX_THEME_DIR, **changes['settings']):
with edxmako.save_lookups():
for template_dir in changes['mako_paths']:
edxmako.paths.add_lookup('main', template_dir, prepend=True)
yield
else:
yield
def dump_theming_info(): def dump_theming_info():
"""Dump a bunch of theming information, for debugging.""" """Dump a bunch of theming information, for debugging."""
for namespace, lookup in edxmako.LOOKUP.items(): for namespace, lookup in edxmako.LOOKUP.items():
......
<%!
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
%>
<%page args="online_help_token"/>
<div class="wrapper-sock wrapper">
<ul class="list-actions list-cta">
<li class="action-item">
<a href="#sock" class="cta cta-show-sock"><i class="icon fa fa-question-circle"></i>
<span class="copy-show is-shown">${_("Looking for help with {studio_name}?").format(studio_name=settings.STUDIO_SHORT_NAME)}</span>
<span class="copy-hide is-hidden">${_("Hide {studio_name} Help").format(studio_name=settings.STUDIO_SHORT_NAME)}</span>
</a>
</li>
</ul>
<div class="wrapper-inner wrapper">
<section class="sock" id="sock">
<header>
<h2 class="title sr">${_("{studio_name} Documentation").format(studio_name=settings.STUDIO_NAME)}</h2>
</header>
<div class="support">
<%!
from django.conf import settings
partner_email = settings.FEATURES.get('PARTNER_SUPPORT_EMAIL', '')
links = [{
'href': 'http://docs.edx.org',
'sr_mouseover_text': _('Access documentation on http://docs.edx.org'),
'text': _('edX Documentation'),
'condition': True
}, {
'href': 'https://partners.edx.org',
'sr_mouseover_text': _('Access Course Staff Support on the Partner Portal to submit or review support tickets'),
'text': _('edX Partner Portal'),
'condition': True
}, {
'href': 'https://www.edx.org/course/overview-creating-edx-course-edx-edx101#.VO4eaLPF-n1',
'sr_mouseover_text': _('Enroll in edX101: Overview of Creating an edX Course'),
'text': _('Enroll in edX101'),
'condition': True
}, {
'href': 'https://www.edx.org/course/creating-course-edx-studio-edx-studiox',
'sr_mouseover_text': _('Enroll in StudioX: Creating a Course with edX Studio'),
'text': _('Enroll in StudioX'),
'condition': True
}, {
'href': 'mailto:{email}'.format(email=partner_email),
'sr_mouseover_text': _('Send an email to {email}').format(email=partner_email),
'text': _('Contact Us'),
'condition': 'PARTNER_SUPPORT_EMAIL' in settings.FEATURES
}]
%>
<ul class="list-actions">
% for link in links:
% if link['condition']:
<li class="action-item">
<a href="${link['href']}" title="${link['sr_mouseover_text']}" rel="external" class="action action-primary">${link['text']}</a>
<span class="tip">${link['sr_mouseover_text']}</span>
</li>
%endif
% endfor
</ul>
</div>
</section>
</div>
</div>
...@@ -114,9 +114,7 @@ from django.core.urlresolvers import reverse ...@@ -114,9 +114,7 @@ from django.core.urlresolvers import reverse
<li>${_("{b_start}Official: {b_end}Receive an instructor-signed certificate with the institution's logo").format(**b_tag_kwargs)}</li> <li>${_("{b_start}Official: {b_end}Receive an instructor-signed certificate with the institution's logo").format(**b_tag_kwargs)}</li>
<li>${_("{b_start}Easily shareable: {b_end}Add the certificate to your CV or resume, or post it directly on LinkedIn").format(**b_tag_kwargs)}</li> <li>${_("{b_start}Easily shareable: {b_end}Add the certificate to your CV or resume, or post it directly on LinkedIn").format(**b_tag_kwargs)}</li>
<li>${_("{b_start}Motivating: {b_end}Give yourself an additional incentive to complete the course").format(**b_tag_kwargs)}</li> <li>${_("{b_start}Motivating: {b_end}Give yourself an additional incentive to complete the course").format(**b_tag_kwargs)}</li>
% if settings.FEATURES.get('IS_EDX_DOMAIN', False):
<li>${_("{b_start}Support our Mission: {b_end} EdX, a non-profit, relies on verified certificates to help fund free education for everyone globally").format(**b_tag_kwargs)}</li> <li>${_("{b_start}Support our Mission: {b_end} EdX, a non-profit, relies on verified certificates to help fund free education for everyone globally").format(**b_tag_kwargs)}</li>
% endif
</ul> </ul>
</div> </div>
<div class="copy-inline list-actions"> <div class="copy-inline list-actions">
......
<%namespace file="../main.html" import="stanford_theme_enabled" />
<%! from django.utils.translation import ugettext as _ %>
${_("Thank you for signing up for {platform_name}.").format(platform_name=settings.PLATFORM_NAME)}
${_("Change your life and start learning today by activating your "
"{platform_name} account. Click on the link below or copy and "
"paste it into your browser's address bar.").format(
platform_name=settings.PLATFORM_NAME
)}
% if is_secure:
https://${ site }/activate/${ key }
% else:
http://${ site }/activate/${ key }
% endif
${_("After you activate your account, you can sign up for "
"and take any of the hundreds of courses {platform_name} offers."
).format(platform_name=settings.PLATFORM_NAME)}
${_("Once you have activated your account, edX will send you email "
"from time to time about new courses or other information.")}
${_("If you need help, please use our web form at "
"{contact_us_url}, email {info_email_address}, "
"or write to {info_postal_address}."
).format(
contact_us_url="https://www.edx.org/contact-us",
info_email_address=settings.CONTACT_EMAIL,
info_postal_address=settings.CONTACT_MAILING_ADDRESS
)}
${_("We hope you enjoy learning with {platform_name}!").format(
platform_name=settings.PLATFORM_NAME
)}
${_("The {platform_name} Team").format(platform_name=settings.PLATFORM_NAME)}
${_("This email was automatically sent by {site_name} because someone "
"attempted to create an {platform_name} account using this email address."
).format(
site_name=settings.SITE_NAME,
platform_name=settings.PLATFORM_NAME
)}
...@@ -32,7 +32,12 @@ ...@@ -32,7 +32,12 @@
<a href="${link['url']}">${link['title']}</a> <a href="${link['url']}">${link['title']}</a>
% endfor % endfor
</nav> </nav>
<p class="copyright">${footer['copyright']}</p> <p class="copyright">${_(
u"\u00A9 edX Inc. All rights reserved except where noted. "
u"EdX, Open edX and the edX and Open EdX logos are registered trademarks "
u"or trademarks of edX Inc."
)}
</p>
## The OpenEdX link may be hidden when this view is served ## The OpenEdX link may be hidden when this view is served
## through an API to partner sites (such as marketing sites or blogs), ## through an API to partner sites (such as marketing sites or blogs),
...@@ -72,6 +77,12 @@ ...@@ -72,6 +77,12 @@
<%include file="widgets/segment-io.html" /> <%include file="widgets/segment-io.html" />
<%include file="widgets/segment-io-footer.html" /> <%include file="widgets/segment-io-footer.html" />
% endif % endif
% if bidi == 'rtl':
<%static:css group='style-lms-footer-edx-rtl'/>
% else:
<%static:css group='style-lms-footer-edx'/>
% endif
% if footer_css_urls: % if footer_css_urls:
% for url in footer_css_urls: % for url in footer_css_urls:
<link rel="stylesheet" type="text/css" href="${url}"></link> <link rel="stylesheet" type="text/css" href="${url}"></link>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment