diff --git a/common/djangoapps/mitxmako/shortcuts.py b/common/djangoapps/mitxmako/shortcuts.py index ebeb0fc180..673efd09dc 100644 --- a/common/djangoapps/mitxmako/shortcuts.py +++ b/common/djangoapps/mitxmako/shortcuts.py @@ -17,6 +17,30 @@ from django.http import HttpResponse from . import middleware from django.conf import settings +from django.core.urlresolvers import reverse + + +def marketing_link(name): + """Returns the correct URL for a link to the marketing site + depending on if the marketing site is enabled + + Since the marketing site is enabled by a setting, we have two + possible URLs for certain links. This function is to decides + which URL should be provided. + """ + + # link_map maps URLs from the marketing site to the old equivalent on + # the Django site + link_map = settings.MKTG_URL_LINK_MAP + if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE'): + # special case for when we only want the root marketing URL + if name == 'ROOT': + return settings.MKTG_URLS.get('ROOT') + return settings.MKTG_URLS.get('ROOT') + settings.MKTG_URLS.get(name) + elif name in link_map: + return reverse(link_map[name]) + else: + return '#' def render_to_string(template_name, dictionary, context=None, namespace='main'): @@ -27,6 +51,7 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'): context_dictionary = {} context_instance['settings'] = settings context_instance['MITX_ROOT_URL'] = settings.MITX_ROOT_URL + context_instance['marketing_link'] = marketing_link # In various testing contexts, there might not be a current request context. if middleware.requestcontext is not None: diff --git a/common/djangoapps/mitxmako/template.py b/common/djangoapps/mitxmako/template.py index 6ef8058c7c..5becfbf1df 100644 --- a/common/djangoapps/mitxmako/template.py +++ b/common/djangoapps/mitxmako/template.py @@ -14,6 +14,7 @@ from django.conf import settings from mako.template import Template as MakoTemplate +from mitxmako.shortcuts import marketing_link from mitxmako import middleware @@ -37,7 +38,6 @@ class Template(MakoTemplate): kwargs.update(overrides) super(Template, self).__init__(*args, **kwargs) - def render(self, context_instance): """ This takes a render call with a context (from Django) and translates @@ -55,5 +55,6 @@ class Template(MakoTemplate): context_dictionary['settings'] = settings context_dictionary['MITX_ROOT_URL'] = settings.MITX_ROOT_URL context_dictionary['django_context'] = context_instance + context_dictionary['marketing_link'] = marketing_link return super(Template, self).render_unicode(**context_dictionary) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index e028f14b7c..c0136b0878 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -387,7 +387,7 @@ def change_enrollment(request): @ensure_csrf_cookie def accounts_login(request, error=""): - return render_to_response('accounts_login.html', {'error': error}) + return render_to_response('login.html', {'error': error}) # Need different levels of logging diff --git a/lms/envs/common.py b/lms/envs/common.py index 86f02c6578..286ea51204 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -36,7 +36,6 @@ DISCUSSION_SETTINGS = { 'MAX_COMMENT_DEPTH': 2, } -EDXMKTG_COOKIE_NAME = 'edxloggedin' # Features MITX_FEATURES = { @@ -584,3 +583,24 @@ INSTALLED_APPS = ( # Discussion forums 'django_comment_client', ) + +######################### MARKETING SITE ############################### +EDXMKTG_COOKIE_NAME = 'edxloggedin' +MKTG_URLS = { + 'ROOT': '', + 'COURSES': '/courses/allschools/allsubjects/allcourses', + 'ABOUT': '/about-us', + 'JOBS': '/jobs', + 'PRESS': '/in-the-news', + 'FAQ': '/student-faq', + 'CONTACT': '/contact', + 'HOW_IT_WORKS': '/how-it-works', + 'SCHOOLS': '/schools', +} +MKTG_URL_LINK_MAP = { + 'ABOUT': 'about_edx', + 'CONTACT': 'contact', + 'FAQ': 'help_edx', + 'COURSES': 'courses', + 'ROOT': 'root', +} diff --git a/lms/templates/accounts_login.html b/lms/templates/accounts_login.html deleted file mode 100644 index db9cca2b22..0000000000 --- a/lms/templates/accounts_login.html +++ /dev/null @@ -1,35 +0,0 @@ -<%! from django.core.urlresolvers import reverse %> -<%inherit file="main.html" /> -<%namespace name='static' file='static_content.html'/> - -<%block name="headextra"> - - - -
- - diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index d9eca70e4d..0bf66872fc 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -328,7 +328,9 @@ % else:

Looks like you haven't registered for any courses yet.

- Find courses now! + + Find courses now! +
% endif diff --git a/lms/templates/footer.html b/lms/templates/footer.html index 642f0cfe01..cb4a1defc4 100644 --- a/lms/templates/footer.html +++ b/lms/templates/footer.html @@ -6,28 +6,33 @@ - \ No newline at end of file + diff --git a/lms/templates/login.html b/lms/templates/login.html index 2cfb40d6bc..ae936b56e5 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -152,10 +152,14 @@

Not Enrolled?

-

Sign up for edX today!

+

Sign up for edX today!

Need Help?

-

Looking for help in logging in or with your edX account? View our help section for answers to commonly asked questions

+

Looking for help in logging in or with your edX account? + + View our help section for answers to commonly asked questions. +

+
diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index ee51a5ff98..67a916d490 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -38,7 +38,11 @@ site_status_msg = get_site_status_msg(course_id)
% endif