Commit c0648ab1 by Zia Fazal Committed by Matt Drayer

moved IS_EDX_DOMAIN dependent feature to edx.org theme

parent 479ce51b
......@@ -136,12 +136,6 @@ FEATURES = {
# Turn off Video Upload Pipeline through Studio, by default
'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
# for consistency in user-experience, keep the value of this feature flag
# in sync with the one in lms/envs/common.py
......
......@@ -23,7 +23,6 @@ from django.core.urlresolvers import reverse
<%!
from django.conf import settings
is_edx_domain = settings.FEATURES.get('IS_EDX_DOMAIN', False)
partner_email = settings.FEATURES.get('PARTNER_SUPPORT_EMAIL', '')
links = [{
......@@ -32,15 +31,10 @@ from django.core.urlresolvers import reverse
'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': is_edx_domain
}, {
'href': 'https://open.edx.org',
'sr_mouseover_text': _('Access the 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',
'sr_mouseover_text': _('Enroll in edX101: Overview of Creating an edX Course'),
......
......@@ -14,6 +14,7 @@ from course_modes.tests.factories import CourseModeFactory
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from student.models import CourseEnrollment
from course_modes.models import CourseMode, Mode
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
@ddt.ddt
......@@ -324,7 +325,7 @@ class CourseModeViewTest(UrlResetMixin, ModuleStoreTestCase):
self.assertEquals(course_modes, expected_modes)
@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):
# Create the course modes
for mode in ["honor", "verified"]:
......
......@@ -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):
"""
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 (
is_marketing_link_set,
is_any_marketing_link_set,
render_to_string,
open_source_footer_context_processor
)
from student.tests.factories import UserFactory
from util.testing import UrlResetMixin
......@@ -69,15 +68,6 @@ class ShortcutsTests(UrlResetMixin, TestCase):
self.assertTrue(is_any_marketing_link_set(['ABOUT', '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):
"""
......
......@@ -22,6 +22,7 @@ from edxmako.shortcuts import render_to_string
from edxmako.tests import mako_middleware_process_request
from util.request import safe_get_host
from util.testing import EventTestMixin
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
class TestException(Exception):
......@@ -99,7 +100,7 @@ class ActivationEmailTests(TestCase):
self._create_account()
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):
self._create_account()
self._assert_activation_email(self.ACTIVATION_SUBJECT, self.EDX_DOMAIN_FRAGMENTS)
......
......@@ -44,6 +44,7 @@ from certificates.tests.factories import GeneratedCertificateFactory # pylint:
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
import shoppingcart # pylint: disable=import-error
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
from config_models.models import cache
......@@ -491,7 +492,7 @@ class DashboardTest(ModuleStoreTestCase):
self.assertEquals(response_2.status_code, 200)
@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):
self.client.login(username="jack", password="test")
response = self.client.get(reverse("dashboard"))
......
......@@ -111,18 +111,13 @@ def _footer_copyright():
Returns: unicode
"""
org_name = (
"edX Inc" if settings.FEATURES.get('IS_EDX_DOMAIN', False)
else microsite.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)
return _(
# Translators: 'EdX', 'edX', and 'Open edX' are trademarks of 'edX Inc.'.
# Please do not translate any of these trademarks and company names.
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"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():
......@@ -389,9 +384,7 @@ def get_logo_url():
# otherwise, use the legacy means to configure this
university = microsite.get_value('university')
if university is None and settings.FEATURES.get('IS_EDX_DOMAIN', False):
return staticfiles_storage.url('images/edx-theme/edx-logo-77x36.png')
elif university:
if university:
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
else:
return staticfiles_storage.url('images/logo.png')
......
# encoding: utf-8
"""Tests of Branding API views. """
import contextlib
import json
import urllib
from django.test import TestCase
......@@ -11,6 +10,7 @@ import mock
import ddt
from config_models.models import cache
from branding.models import BrandingApiConfig
from openedx.core.djangoapps.theming.test_util import with_edx_domain_context
@ddt.ddt
......@@ -42,7 +42,7 @@ class TestFooter(TestCase):
@ddt.unpack
def test_footer_content_types(self, is_edx_domain, accepts, content_type, content):
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)
self.assertEqual(resp.status_code, 200)
......@@ -53,7 +53,7 @@ class TestFooter(TestCase):
@ddt.data(True, False)
def test_footer_json(self, is_edx_domain):
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()
self.assertEqual(resp.status_code, 200)
......@@ -153,7 +153,7 @@ class TestFooter(TestCase):
def test_language_rtl(self, is_edx_domain, language, static_path):
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})
self.assertEqual(resp.status_code, 200)
......@@ -172,7 +172,7 @@ class TestFooter(TestCase):
def test_show_openedx_logo(self, is_edx_domain, show_logo):
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 {}
resp = self._get_footer(accepts="text/html", params=params)
......@@ -195,7 +195,7 @@ class TestFooter(TestCase):
@ddt.unpack
def test_include_dependencies(self, is_edx_domain, include_dependencies):
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 {}
resp = self._get_footer(accepts="text/html", params=params)
......@@ -227,9 +227,3 @@ class TestFooter(TestCase):
)
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):
"""
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[version][bidi]
css_name = settings.FOOTER_CSS['openedx'][bidi]
context = {
'hide_openedx_link': not show_openedx_logo,
......@@ -159,11 +158,7 @@ def _render_footer_html(request, show_openedx_logo, include_dependencies):
'include_dependencies': include_dependencies,
}
return (
render_to_response("footer-edx-v3.html", context)
if settings.FEATURES.get("IS_EDX_DOMAIN", False)
else render_to_response("footer.html", context)
)
return render_to_response("footer.html", context)
@cache_control(must_revalidate=True, max_age=settings.FOOTER_BROWSER_CACHE_MAX_AGE)
......
......@@ -10,6 +10,7 @@ from django.test import TestCase
import mock
from student.tests.factories import UserFactory
from openedx.core.djangoapps.theming.test_util import with_is_edx_domain
class UserMixin(object):
......@@ -86,7 +87,7 @@ class ReceiptViewTests(UserMixin, TestCase):
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)
@mock.patch.dict(settings.FEATURES, {"IS_EDX_DOMAIN": True})
@with_is_edx_domain(True)
def test_hide_nav_header(self):
self._login()
post_data = {'decision': 'ACCEPT', 'reason_code': '200', 'signed_field_names': 'dummy'}
......
......@@ -26,6 +26,7 @@ from student_account.views import account_settings_context
from third_party_auth.tests.testutil import simulate_running_pipeline, ThirdPartyAuthTestMixin
from util.testing import UrlResetMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from openedx.core.djangoapps.theming.test_util import with_edx_domain_context
@ddt.ddt
......@@ -254,7 +255,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
# The response should have a "Sign In" button with the URL
# 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)
expected_url = '/login?{}'.format(self._finish_auth_url_param(params + [('next', '/dashboard')]))
......@@ -270,7 +271,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
]
# 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)
expected_url = '/login?{}'.format(self._finish_auth_url_param(params))
......
......@@ -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 embargo.test_utils import restrict_course
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 student.tests.factories import UserFactory, CourseEnrollmentFactory
from student.models import CourseEnrollment
......@@ -282,7 +283,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin):
)
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")
def test_pay_and_verify_hides_header_nav(self, payment_flow):
course = self._create_course("verified")
......
......@@ -180,9 +180,6 @@ FEATURES = {
# Enable Custom Courses for EdX
'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
'ENABLE_VERIFIED_CERTIFICATES': False,
......@@ -496,9 +493,6 @@ TEMPLATES = [
# Hack to get required link URLs to password reset templates
'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.context_processor.user_has_cart_context_processor',
......
......@@ -29,7 +29,6 @@ FEATURES['MULTIPLE_ENROLLMENT_ROLES'] = True
FEATURES['ENABLE_SHOPPING_CART'] = True
FEATURES['AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'] = 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
......
<%inherit file="../main.html" />
<%!
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
%>
<%block name="bodyclass">register verification-process step-select-track</%block>
<%block name="pagetitle">
${_("Enroll In {} | Choose Your Track").format(course_name)}
</%block>
<%block name="js_extra">
<script type="text/javascript">
var expandCallback = function(event) {
event.preventDefault();
$(this).next('.expandable-area').slideToggle();
var title = $(this).parent();
title.toggleClass('is-expanded');
if (title.attr("aria-expanded") === "false") {
title.attr("aria-expanded", "true");
} else {
title.attr("aria-expanded", "false");
}
}
$(document).ready(function() {
$('.expandable-area').slideUp();
$('.is-expandable').addClass('is-ready');
$('.is-expandable .title-expand').click(expandCallback);
$('.is-expandable .title-expand').keypress(function(e) {
if (e.which == 13) { // only activate on pressing enter
expandCallback.call(this, e); // make sure that we bind `this` correctly
}
});
$('#contribution-other-amt').focus(function() {
$('#contribution-other').attr('checked',true);
});
});
</script>
</%block>
<%block name="content">
% if error:
<div class="wrapper-msg wrapper-msg-error">
<div class=" msg msg-error">
<i class="msg-icon icon fa fa-exclamation-triangle"></i>
<div class="msg-content">
<h3 class="title">${_("Sorry, there was an error when trying to enroll you")}</h3>
<div class="copy">
<p>${error}</p>
</div>
</div>
</div>
</div>
%endif
<div class="container">
<section class="wrapper">
<div class="wrapper-register-choose wrapper-content-main">
<article class="register-choose content-main">
<header class="page-header content-main">
<h3 class="title">
${_("Congratulations! You are now enrolled in {course_name}").format(course_name=course_name)}
</h3>
</header>
<form class="form-register-choose" method="post" name="enrollment_mode_form" id="enrollment_mode_form">
<%
b_tag_kwargs = {'b_start': '<b>', 'b_end': '</b>'}
%>
% if "verified" in modes:
<div class="register-choice register-choice-certificate">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
% if has_credit_upsell:
<h4 class="title">${_("Pursue Academic Credit with a Verified Certificate")}</h4>
<div class="copy">
<p>${_("Become eligible for academic credit and highlight your new skills and knowledge with a verified certificate. Use this valuable credential to qualify for academic credit, advance your career, or strengthen your school applications.")}</p>
<p>
<div class="wrapper-copy-inline">
<div class="copy-inline">
<h4>${_("Benefits of a Verified Certificate")}</h4>
<ul>
<li>${_("{b_start}Eligible for credit:{b_end} Receive academic credit after successfully completing the course").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>
</ul>
</div>
<div class="copy-inline list-actions">
<ul class="list-actions">
<li class="action action-select">
<input type="hidden" name="contribution" value="${min_price}" />
<input type="submit" name="verified_mode" value="${_('Pursue a Verified Certificate')} ($${min_price} USD)" />
</li>
</ul>
</div>
</div>
</p>
</div>
% else:
<h4 class="title">${_("Pursue a Verified Certificate")}</h4>
<div class="copy">
<p>${_("Highlight your new knowledge and skills with a verified certificate. Use this valuable credential to improve your job prospects and advance your career, or highlight your certificate in school applications.")}</p>
<p>
<div class="wrapper-copy-inline">
<div class="copy-inline">
<h4>${_("Benefits of a Verified Certificate")}</h4>
<ul>
<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}Motivating: {b_end}Give yourself an additional incentive to complete the course").format(**b_tag_kwargs)}</li>
</ul>
</div>
<div class="copy-inline list-actions">
<ul class="list-actions">
<li class="action action-select">
<input type="hidden" name="contribution" value="${min_price}" />
<input type="submit" name="verified_mode" value="${_('Pursue a Verified Certificate')} ($${min_price} USD)" />
</li>
</ul>
</div>
</div>
</p>
</div>
% endif
</div>
</div>
% endif
% if "honor" in modes:
<span class="deco-divider">
<span class="copy">${_("or")}</span>
</span>
<div class="register-choice register-choice-audit">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
<h4 class="title">${_("Audit This Course")}</h4>
<div class="copy">
<p>${_("Audit this course for free and have complete access to all the course material, activities, tests, and forums.")}</p>
</div>
</div>
<ul class="list-actions">
<li class="action action-select">
<input type="submit" name="honor_mode" value="${_('Audit This Course')}" />
</li>
</ul>
</div>
% elif "audit" in modes:
<span class="deco-divider">
<span class="copy">${_("or")}</span>
</span>
<div class="register-choice register-choice-audit">
<div class="wrapper-copy">
<span class="deco-ribbon"></span>
<h4 class="title">${_("Audit This Course (No Certificate)")}</h4>
<div class="copy">
## Translators: b_start notes the beginning of a section of text bolded for emphasis, and b_end marks the end of the bolded text.
<p>${_("Audit this course for free and have complete access to all the course material, activities, tests, and forums. {b_start}Please note that this track does not offer a certificate for learners who earn a passing grade.{b_end}".format(**b_tag_kwargs))}</p>
</div>
</div>
<ul class="list-actions">
<li class="action action-select">
<input type="submit" name="audit_mode" value="${_('Audit This Course')}" />
</li>
</ul>
</div>
% endif
<input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
</form>
</article>
</div> <!-- /wrapper-content-main -->
</section>
</div>
</%block>
......@@ -151,13 +151,6 @@ import json
<section id="dashboard-search-results" class="search-results dashboard-search-results"></section>
% 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">
<header class="profile">
<h2 class="account-status-title sr">${_("Account Status Info")}: </h2>
......
......@@ -14,37 +14,7 @@ ${_("Change your life and start learning today by activating your "
http://${ site }/activate/${ key }
% endif
% if settings.FEATURES.get('IS_EDX_DOMAIN'):
${_("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 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 "
"receive any more email from us. Please do not reply to this e-mail; "
"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.
from functools import wraps
import os
import os.path
import contextlib
from mock import patch
......@@ -15,6 +16,8 @@ import edxmako
from .core import comprehensive_theme_changes
EDX_THEME_DIR = settings.REPO_ROOT / "themes" / "edx.org"
def with_comprehensive_theme(theme_dir):
"""
......@@ -46,11 +49,7 @@ def with_comprehensive_theme(theme_dir):
def with_is_edx_domain(is_edx_domain):
"""
A decorator to run a test as if IS_EDX_DOMAIN is true or false.
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.
A decorator 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?
......@@ -61,16 +60,34 @@ def with_is_edx_domain(is_edx_domain):
def _decorator(func): # pylint: disable=missing-docstring
if is_edx_domain:
# This applies @with_comprehensive_theme to the func.
func = with_comprehensive_theme(settings.REPO_ROOT / "themes" / "edx.org")(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)
func = with_comprehensive_theme(EDX_THEME_DIR)(func)
return func
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():
"""Dump a bunch of theming information, for debugging."""
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
<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}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>
% endif
</ul>
</div>
<div class="copy-inline list-actions">
......
<%inherit file="main.html" />
<%namespace name='static' file='static_content.html'/>
<%!
from django.utils.translation import ugettext as _
from django.template import RequestContext
import third_party_auth
from third_party_auth import pipeline
from microsite_configuration import microsite
from django.core.urlresolvers import reverse
import json
%>
<%
cert_name_short = settings.CERT_NAME_SHORT
cert_name_long = settings.CERT_NAME_LONG
%>
<%block name="pagetitle">${_("Dashboard")}</%block>
<%block name="bodyclass">view-dashboard is-authenticated</%block>
<%block name="nav_skip">#my-courses</%block>
<%block name="header_extras">
% for template_name in ["donation"]:
<script type="text/template" id="${template_name}-tpl">
<%static:include path="dashboard/${template_name}.underscore" />
</script>
% endfor
% for template_name in ["dashboard_search_item", "dashboard_search_results", "search_loading", "search_error"]:
<script type="text/template" id="${template_name}-tpl">
<%static:include path="search/${template_name}.underscore" />
</script>
% endfor
</%block>
<%block name="js_extra">
<script src="${static.url('js/commerce/credit.js')}"></script>
<%static:js group='dashboard'/>
<script type="text/javascript">
$(document).ready(function() {
edx.dashboard.legacy.init({
dashboard: "${reverse('dashboard')}",
signInUser: "${reverse('signin_user')}",
changeEmailSettings: "${reverse('change_email_settings')}"
});
});
</script>
% if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
<%static:require_module module_name="js/search/dashboard/dashboard_search_factory" class_name="DashboardSearchFactory">
DashboardSearchFactory();
</%static:require_module>
% endif
% if redirect_message:
<%static:require_module module_name="js/views/message_banner" class_name="MessageBannerView">
var banner = new MessageBannerView({urgency: 'low', type: 'warning'});
$('#content').prepend(banner.$el);
banner.showMessage(${json.dumps(redirect_message)})
</%static:require_module>
% endif
</%block>
<div class="dashboard-notifications" tabindex="-1">
%if message:
<section class="dashboard-banner">
${message}
</section>
%endif
%if enrollment_message:
<section class="dashboard-banner">
${enrollment_message}
</section>
%endif
</div>
<section class="container dashboard" id="dashboard-main">
<section class="my-courses" id="my-courses" role="main" aria-label="Content">
<header class="wrapper-header-courses">
<h2 class="header-courses">${_("My Courses")}</h2>
</header>
% if len(course_enrollments) > 0:
<ul class="listing-courses">
<% share_settings = getattr(settings, 'SOCIAL_SHARING_SETTINGS', {}) %>
% for dashboard_index, enrollment in enumerate(course_enrollments):
<% show_courseware_link = (enrollment.course_id in show_courseware_links_for) %>
<% cert_status = cert_statuses.get(enrollment.course_id) %>
<% can_unenroll = (not cert_status) or cert_status.get('can_unenroll') %>
<% credit_status = credit_statuses.get(enrollment.course_id) %>
<% show_email_settings = (enrollment.course_id in show_email_settings_for) %>
<% course_mode_info = all_course_modes.get(enrollment.course_id) %>
<% show_refund_option = (enrollment.course_id in show_refund_option_for) %>
<% is_paid_course = (enrollment.course_id in enrolled_courses_either_paid) %>
<% is_course_blocked = (enrollment.course_id in block_courses) %>
<% course_verification_status = verification_status_by_course.get(enrollment.course_id, {}) %>
<% course_requirements = courses_requirements_not_met.get(enrollment.course_id) %>
<% course_program_info = course_programs.get(unicode(enrollment.course_id)) %>
<%include file = 'dashboard/_dashboard_course_listing.html' args="course_overview=enrollment.course_overview, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, can_unenroll=can_unenroll, credit_status=credit_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, show_refund_option=show_refund_option, is_paid_course=is_paid_course, is_course_blocked=is_course_blocked, verification_status=course_verification_status, course_requirements=course_requirements, dashboard_index=dashboard_index, share_settings=share_settings, user=user, course_program_info=course_program_info" />
% endfor
</ul>
% else:
<section class="empty-dashboard-message">
<p>${_("Looks like you haven't enrolled in any courses yet.")}</p>
% if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<a href="${marketing_link('COURSES')}">
${_("Find courses now!")}
</a>
%endif
</section>
% endif
% if staff_access and len(errored_courses) > 0:
<div id="course-errors">
<h2>${_("Course-loading errors")}</h2>
% for course_dir, errors in errored_courses.items():
<h3>${course_dir | h}</h3>
<ul>
% for (msg, err) in errors:
<li>${msg}
<ul><li><pre>${err}</pre></li></ul>
</li>
% endfor
</ul>
% endfor
</div>
% endif
</section>
% if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
<div id="dashboard-search-bar" class="search-bar dashboard-search-bar" role="search" aria-label="Dashboard">
<form>
<label for="dashboard-search-input">${_('Search Your Courses')}</label>
<div class="search-field-wrapper">
<input id="dashboard-search-input" type="text" class="search-field"/>
<button type="submit" class="search-button" aria-label="${_('Search')}">
<i class="icon fa fa-search" aria-hidden="true"></i>
</button>
<button type="button" class="cancel-button" aria-label="${_('Clear search')}">
<i class="icon fa fa-remove" aria-hidden="true"></i>
</button>
</div>
</form>
</div>
% endif
% if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
<section id="dashboard-search-results" class="search-results dashboard-search-results"></section>
% endif
% if 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">
<header class="profile">
<h2 class="account-status-title sr">${_("Account Status Info")}: </h2>
</header>
<section class="user-info">
<ul>
% if len(order_history_list):
<li class="order-history">
<span class="title">${_("Order History")}</span>
% for order_history_item in order_history_list:
<span><a href="${order_history_item['receipt_url']}" target="_blank" class="edit-name">${order_history_item['order_date']}</a></span>
% endfor
</li>
% endif
<%include file="${microsite.get_template_path('dashboard/_dashboard_status_verification.html')}" />
</ul>
</section>
</section>
</section>
<section id="email-settings-modal" class="modal" aria-hidden="true">
<div class="inner-wrapper" role="dialog" aria-labelledby="email-settings-title">
<button class="close-modal">
<i class="icon fa fa-remove"></i>
<span class="sr">
## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
${_("Close")}
</span>
</button>
<header>
<h2 id="email-settings-title">
${_("Email Settings for {course_number}").format(course_number='<span id="email_settings_course_number"></span>')}
<span class="sr">,
## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
${_("window open")}
</span>
</h2>
<hr/>
</header>
<form id="email_settings_form" method="post">
<input name="course_id" id="email_settings_course_id" type="hidden" />
<label>${_("Receive course emails")} <input type="checkbox" id="receive_emails" name="receive_emails" /></label>
<div class="submit">
<input type="submit" id="submit" value="${_("Save Settings")}" />
</div>
</form>
</div>
</section>
<section id="unenroll-modal" class="modal unenroll-modal" aria-hidden="true">
<div class="inner-wrapper" role="dialog" aria-labelledby="unenrollment-modal-title">
<button class="close-modal">
<i class="icon fa fa-remove"></i>
<span class="sr">
## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
${_("Close")}
</span>
</button>
<header>
<h2 id="unenrollment-modal-title">
<span id='track-info'></span>
<span id='refund-info'></span>
<span class="sr">,
## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
${_("window open")}
</span>
</h2>
<hr/>
</header>
<div id="unenroll_error" class="modal-form-error"></div>
<form id="unenroll_form" method="post" data-remote="true" action="${reverse('change_enrollment')}">
<input name="course_id" id="unenroll_course_id" type="hidden" />
<input name="enrollment_action" type="hidden" value="unenroll" />
<div class="submit">
<input name="submit" type="submit" value="${_("Unenroll")}" />
</div>
</form>
</div>
</section>
<%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 @@
<a href="${link['url']}">${link['title']}</a>
% endfor
</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
## through an API to partner sites (such as marketing sites or blogs),
......@@ -72,6 +77,12 @@
<%include file="widgets/segment-io.html" />
<%include file="widgets/segment-io-footer.html" />
% 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:
% for url in footer_css_urls:
<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