diff --git a/common/djangoapps/external_auth/tests/test_shib.py b/common/djangoapps/external_auth/tests/test_shib.py index fdcf940449..0ef912464b 100644 --- a/common/djangoapps/external_auth/tests/test_shib.py +++ b/common/djangoapps/external_auth/tests/test_shib.py @@ -202,7 +202,7 @@ class ShibSPTest(ModuleStoreTestCase): else: self.assertEqual(response.status_code, 200) self.assertContains(response, - ("Preferences for {platform_name}" + ("Preferences for {platform_name}" .format(platform_name=settings.PLATFORM_NAME))) # no audit logging calls self.assertEquals(len(audit_log_calls), 0) diff --git a/common/djangoapps/microsite_configuration/__init__.py b/common/djangoapps/microsite_configuration/__init__.py index e69de29bb2..cc081c890a 100644 --- a/common/djangoapps/microsite_configuration/__init__.py +++ b/common/djangoapps/microsite_configuration/__init__.py @@ -0,0 +1 @@ +from .templatetags.microsite import page_title_breadcrumbs diff --git a/common/djangoapps/microsite_configuration/templatetags/__init__.py b/common/djangoapps/microsite_configuration/templatetags/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/common/djangoapps/microsite_configuration/templatetags/microsite.py b/common/djangoapps/microsite_configuration/templatetags/microsite.py new file mode 100644 index 0000000000..269ba82640 --- /dev/null +++ b/common/djangoapps/microsite_configuration/templatetags/microsite.py @@ -0,0 +1,40 @@ +""" +Template tags and helper functions for displaying breadcrumbs in page titles +based on the current micro site. +""" +from django import template +from django.conf import settings +from microsite_configuration.middleware import MicrositeConfiguration + +register = template.Library() + + +def page_title_breadcrumbs(*crumbs, **kwargs): + """ + This function creates a suitable page title in the form: + Specific | Less Specific | General | edX + It will output the correct platform name for the request. + Pass in a `separator` kwarg to override the default of " | " + """ + separator = kwargs.get("separator", " | ") + if crumbs: + return '{}{}{}'.format(separator.join(crumbs), separator, platform_name()) + else: + return platform_name() + +@register.simple_tag(name="page_title_breadcrumbs", takes_context=True) +def page_title_breadcrumbs_tag(context, *crumbs): + """ + Django template that creates breadcrumbs for page titles: + {% page_title_breadcrumbs "Specific" "Less Specific" General %} + """ + return page_title_breadcrumbs(*crumbs) + + +@register.simple_tag(name="platform_name") +def platform_name(): + """ + Django template tag that outputs the current platform name: + {% platform_name %} + """ + return MicrositeConfiguration.get_microsite_configuration_value('platform_name', settings.PLATFORM_NAME) \ No newline at end of file diff --git a/common/djangoapps/student/tests/test_login.py b/common/djangoapps/student/tests/test_login.py index 6593412cf4..9be1e7de04 100644 --- a/common/djangoapps/student/tests/test_login.py +++ b/common/djangoapps/student/tests/test_login.py @@ -255,7 +255,7 @@ class ExternalAuthShibTest(ModuleStoreTestCase): noshib_response = self.client.get(TARGET_URL, follow=True) self.assertEqual(noshib_response.redirect_chain[-1], ('http://testserver/accounts/login?next={url}'.format(url=TARGET_URL), 302)) - self.assertContains(noshib_response, ("Log into your {platform_name} Account" + self.assertContains(noshib_response, ("Log into your {platform_name} Account | {platform_name}" .format(platform_name=settings.PLATFORM_NAME))) self.assertEqual(noshib_response.status_code, 200) diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index dea0e6f0f3..da9b88de57 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -57,7 +57,7 @@ def i_visit_the_dashboard(step): @step('I should be on the dashboard page$') def i_should_be_on_the_dashboard(step): assert world.is_css_present('section.container.dashboard') - assert world.browser.title == 'Dashboard' + assert 'Dashboard' in world.browser.title @step(u'I (?:visit|access|open) the courses page$') diff --git a/common/lib/xmodule/xmodule/js/src/sequence/display.coffee b/common/lib/xmodule/xmodule/js/src/sequence/display.coffee index b78d3c62f4..8a9a6a2cd9 100644 --- a/common/lib/xmodule/xmodule/js/src/sequence/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/sequence/display.coffee @@ -5,6 +5,7 @@ class @Sequence @num_contents = @contents.length @id = @el.data('id') @ajaxUrl = @el.data('ajax-url') + @base_page_title = " | " + document.title @initProgress() @bind() @render parseInt(@el.data('position')) @@ -18,7 +19,10 @@ class @Sequence initProgress: -> @progressTable = {} # "#problem_#{id}" -> progress - + updatePageTitle: -> + # update the page title to include the current section + document.title = @link_for(@position).data('title') + @base_page_title + hookUpProgressEvent: -> $('.problems-wrapper').bind 'progressChanged', @updateProgress @@ -100,6 +104,7 @@ class @Sequence @position = new_position @toggleArrows() @hookUpProgressEvent() + @updatePageTitle() sequence_links = @$('#seq_content a.seqnav') sequence_links.click @goto diff --git a/common/templates/course_modes/choose.html b/common/templates/course_modes/choose.html index 513dd98621..1932e53ac7 100644 --- a/common/templates/course_modes/choose.html +++ b/common/templates/course_modes/choose.html @@ -1,16 +1,15 @@ <%! from django.utils.translation import ugettext as _ %> <%! from django.core.urlresolvers import reverse %> + <%inherit file="../main.html" /> <%block name="bodyclass">register verification-process step-select-track ${'is-upgrading' if upgrade else ''} -<%block name="title"> - +<%block name="pagetitle"> %if upgrade: ${_("Upgrade Your Registration for {} | Choose Your Track").format(course_name)} %else: ${_("Register for {} | Choose Your Track").format(course_name)} %endif - <%block name="js_extra"> diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/tos.html b/common/test/test_microsites/test_microsite/templates/static_templates/tos.html index 414754d82b..1c51496b17 100644 --- a/common/test/test_microsites/test_microsite/templates/static_templates/tos.html +++ b/common/test/test_microsites/test_microsite/templates/static_templates/tos.html @@ -4,7 +4,7 @@ <%namespace name='static' file='../static_content.html'/> -<%block name="title">Terms of Service +<%block name="pagetitle">${_("Terms of Service")}

edX Terms of Service

diff --git a/lms/djangoapps/courseware/features/high-level-tabs.feature b/lms/djangoapps/courseware/features/high-level-tabs.feature index 8b7fdd300d..2b0e9a9209 100644 --- a/lms/djangoapps/courseware/features/high-level-tabs.feature +++ b/lms/djangoapps/courseware/features/high-level-tabs.feature @@ -13,6 +13,6 @@ Scenario: I can navigate to all high - level tabs in a course | TabName | PageTitle | | Courseware | 6.002x Courseware | | Course Info | 6.002x Course Info | - | Custom Tab | 6.002x Custom Tab | - | Wiki | edX Wiki | + | Custom Tab | Custom Tab | 6.002x | + | Wiki | Wiki | edX | | Progress | 6.002x Progress | diff --git a/lms/djangoapps/courseware/tests/test_microsites.py b/lms/djangoapps/courseware/tests/test_microsites.py index e9cd776376..c9fa0d08c3 100644 --- a/lms/djangoapps/courseware/tests/test_microsites.py +++ b/lms/djangoapps/courseware/tests/test_microsites.py @@ -72,7 +72,7 @@ class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase): self.assertContains(resp, 'This is a Test Microsite Overlay') # Overlay test message self.assertContains(resp, 'test_microsite/images/header-logo.png') # logo swap self.assertContains(resp, 'test_microsite/css/test_microsite.css') # css override - self.assertContains(resp, 'Test Microsite') # page title + self.assertContains(resp, 'Test Microsite') # page title # assert that test course display name is visible self.assertContains(resp, 'Robot_Super_Course') diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index e60b6c5394..fa713a4501 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -328,7 +328,7 @@ def index(request, course_id, chapter=None, section=None, # Save where we are in the chapter save_child_position(chapter_module, section) context['fragment'] = section_module.render('student_view') - + context['section_title'] = section_descriptor.display_name_with_default else: # section is none, so display a message prev_section = get_current_child(chapter_module) diff --git a/lms/envs/common.py b/lms/envs/common.py index 5bf9268388..685c9bbb8b 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1062,6 +1062,7 @@ INSTALLED_APPS = ( # Dark-launching languages 'dark_lang', + 'microsite_configuration', ) ######################### MARKETING SITE ############################### diff --git a/lms/templates/course_groups/debug.html b/lms/templates/course_groups/debug.html index 13f27e87fa..a70d4151ee 100644 --- a/lms/templates/course_groups/debug.html +++ b/lms/templates/course_groups/debug.html @@ -3,7 +3,7 @@ ## "edX" should not be translated - <%block name="title">edX + <%block name="pagetitle"> diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 44143ad03b..0a6c5b346b 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -113,7 +113,7 @@ -<%block name="title">${_("About {course.display_number_with_default}").format(course=course) | h} +<%block name="pagetitle">${_("About {course.display_number_with_default}").format(course=course) | h}
diff --git a/lms/templates/courseware/courses.html b/lms/templates/courseware/courses.html index 9351980336..d84c691ab3 100644 --- a/lms/templates/courseware/courses.html +++ b/lms/templates/courseware/courses.html @@ -3,7 +3,7 @@ <%namespace name='static' file='../static_content.html'/> -<%block name="title">${_("Courses")} +<%block name="pagetitle">${_("Courses")} <%! from microsite_configuration.middleware import MicrositeConfiguration %>
diff --git a/lms/templates/courseware/courseware-error.html b/lms/templates/courseware/courseware-error.html index 71744259a6..843c7122ab 100644 --- a/lms/templates/courseware/courseware-error.html +++ b/lms/templates/courseware/courseware-error.html @@ -2,7 +2,7 @@ <%inherit file="/main.html" /> <%namespace name='static' file='../static_content.html'/> <%block name="bodyclass">courseware -<%block name="title">${_("Courseware")} - ${settings.PLATFORM_NAME} +<%block name="pagetitle">${_("Courseware")} <%block name="headextra"> <%static:css group='style-course-vendor'/> diff --git a/lms/templates/courseware/courseware.html b/lms/templates/courseware/courseware.html index 9a6a197de0..450eea94a2 100644 --- a/lms/templates/courseware/courseware.html +++ b/lms/templates/courseware/courseware.html @@ -1,8 +1,19 @@ <%! from django.utils.translation import ugettext as _ %> +<%! from microsite_configuration import page_title_breadcrumbs %> <%inherit file="/main.html" /> <%namespace name='static' file='/static_content.html'/> +<%def name="course_name()"> + <% return _("{course_number} Courseware").format(course_number=course.display_number_with_default) %> + + <%block name="bodyclass">courseware ${course.css_class} -<%block name="title">${_("{course_number} Courseware").format(course_number=course.display_number_with_default) | h} +<%block name="title"> + % if section_title: +${page_title_breadcrumbs(section_title, course_name())} + % else: +${page_title_breadcrumbs(course_name())} + %endif + <%block name="headextra"> <%static:css group='style-course-vendor'/> diff --git a/lms/templates/courseware/info.html b/lms/templates/courseware/info.html index 5c2220010a..518cb0f784 100644 --- a/lms/templates/courseware/info.html +++ b/lms/templates/courseware/info.html @@ -1,18 +1,18 @@ <%! from django.utils.translation import ugettext as _ %> +<%! from courseware.courses import get_course_info_section %> + <%inherit file="/main.html" /> -<%block name="bodyclass">${course.css_class} <%namespace name='static' file='/static_content.html'/> +<%block name="pagetitle">${_("{course.display_number_with_default} Course Info").format(course=course) | h} + <%block name="headextra"> <%static:css group='style-course-vendor'/> <%static:css group='style-course'/> -<%block name="title">${_("{course.display_number_with_default} Course Info").format(course=course) | h} + <%include file="/courseware/course_navigation.html" args="active_page='info'" /> -<%! - from courseware.courses import get_course_info_section -%> <%block name="js_extra"> @@ -23,6 +23,7 @@ $(document).ready(function(){ +<%block name="bodyclass">${course.css_class}
% if user.is_authenticated(): diff --git a/lms/templates/courseware/instructor_dashboard.html b/lms/templates/courseware/instructor_dashboard.html index 1ace8daaee..2b7b6d6e11 100644 --- a/lms/templates/courseware/instructor_dashboard.html +++ b/lms/templates/courseware/instructor_dashboard.html @@ -1,8 +1,10 @@ <%! from django.utils.translation import ugettext as _ %> -<%inherit file="/main.html" /> <%! from django.core.urlresolvers import reverse %> + +<%inherit file="../main.html" /> <%namespace name='static' file='/static_content.html'/> +<%block name="pagetitle">${_("Instructor Dashboard")} <%block name="headextra"> <%static:css group='style-course-vendor'/> <%static:css group='style-course'/> diff --git a/lms/templates/courseware/mktg_coming_soon.html b/lms/templates/courseware/mktg_coming_soon.html index 0c90362019..78cf52d88d 100644 --- a/lms/templates/courseware/mktg_coming_soon.html +++ b/lms/templates/courseware/mktg_coming_soon.html @@ -8,7 +8,7 @@ <%inherit file="../mktg_iframe.html" /> -<%block name="title">${_("About {course_id}").format(course_id=course_id)} +<%block name="pagetitle">${_("About {course_id}").format(course_id=course_id)} <%block name="bodyclass">view-iframe-content view-partial-mktgregister diff --git a/lms/templates/courseware/mktg_course_about.html b/lms/templates/courseware/mktg_course_about.html index 220dd45550..64c6661a30 100644 --- a/lms/templates/courseware/mktg_course_about.html +++ b/lms/templates/courseware/mktg_course_about.html @@ -8,7 +8,7 @@ <%inherit file="../mktg_iframe.html" /> -<%block name="title">${_("About {course_number}").format(course_number=course.display_number_with_default) | h} +<%block name="pagetitle">${_("About {course_number}").format(course_number=course.display_number_with_default) | h} <%block name="bodyclass">view-iframe-content view-partial-mktgregister diff --git a/lms/templates/courseware/news.html b/lms/templates/courseware/news.html index c56319b4f7..fa848c0036 100644 --- a/lms/templates/courseware/news.html +++ b/lms/templates/courseware/news.html @@ -2,7 +2,7 @@ <%inherit file="main.html" /> <%namespace name='static' file='../static_content.html'/> <%block name="bodyclass">courseware news -<%block name="title">${_("News - MITx 6.002x")} +<%block name="pagetitle">${_("News - MITx 6.002x")} <%block name="headextra"> <%static:css group='style-course-vendor'/> diff --git a/lms/templates/courseware/progress.html b/lms/templates/courseware/progress.html index 6cb80e43e2..534f7222fa 100644 --- a/lms/templates/courseware/progress.html +++ b/lms/templates/courseware/progress.html @@ -9,7 +9,7 @@ <%namespace name="progress_graph" file="/courseware/progress_graph.js"/> -<%block name="title">${_("{course_number} Progress").format(course_number=course.display_number_with_default) | h} +<%block name="pagetitle">${_("{course_number} Progress").format(course_number=course.display_number_with_default) | h} <%! from django.core.urlresolvers import reverse diff --git a/lms/templates/courseware/static_tab.html b/lms/templates/courseware/static_tab.html index 464aec0bca..2efc351cc4 100644 --- a/lms/templates/courseware/static_tab.html +++ b/lms/templates/courseware/static_tab.html @@ -7,7 +7,7 @@ <%static:css group='style-course'/> -<%block name="title">${course.display_number_with_default | h} ${tab['name']} +<%block name="pagetitle">${tab['name']} | ${course.display_number_with_default | h} <%include file="/courseware/course_navigation.html" args="active_page='static_tab_{0}'.format(tab['url_slug'])" /> diff --git a/lms/templates/courseware/syllabus.html b/lms/templates/courseware/syllabus.html index d26fd259f7..302e14a0bb 100644 --- a/lms/templates/courseware/syllabus.html +++ b/lms/templates/courseware/syllabus.html @@ -7,7 +7,7 @@ <%static:css group='style-course'/> -<%block name="title">${_("{course.display_number_with_default} Course Info").format(course=course) | h} +<%block name="pagetitle">${_("{course.display_number_with_default} Course Info").format(course=course) | h} <%include file="/courseware/course_navigation.html" args="active_page='syllabus'" /> <%! diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 523eecfe96..33470d1d0b 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -8,7 +8,7 @@ <%namespace name='static' file='static_content.html'/> -<%block name="title">${_("Dashboard")} +<%block name="pagetitle">${_("Dashboard")} <%block name="bodyclass">view-dashboard is-authenticated <%block name="js_extra"> diff --git a/lms/templates/discussion/index.html b/lms/templates/discussion/index.html index 04e367c8b9..4d4c350fe0 100644 --- a/lms/templates/discussion/index.html +++ b/lms/templates/discussion/index.html @@ -6,7 +6,7 @@ <%inherit file="../main.html" /> <%namespace name='static' file='../static_content.html'/> <%block name="bodyclass">discussion -<%block name="title">${_("Discussion - {course_number}").format(course_number=course.display_number_with_default) | h} +<%block name="pagetitle">${_("Discussion - {course_number}").format(course_number=course.display_number_with_default) | h} <%block name="headextra"> <%static:css group='style-course-vendor'/> diff --git a/lms/templates/discussion/user_profile.html b/lms/templates/discussion/user_profile.html index 53ff77a78b..7f5cee42d6 100644 --- a/lms/templates/discussion/user_profile.html +++ b/lms/templates/discussion/user_profile.html @@ -4,7 +4,7 @@ <%inherit file="../main.html" /> <%namespace name='static' file='../static_content.html'/> <%block name="bodyclass">discussion -<%block name="title">${_("Discussion - {course_number}").format(course_number=course.display_number_with_default) | h} +<%block name="pagetitle">${_("Discussion - {course_number}").format(course_number=course.display_number_with_default) | h} <%block name="headextra"> <%static:css group='style-course-vendor'/> diff --git a/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html b/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html index b628a5af84..d9dcdde13b 100644 --- a/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html +++ b/lms/templates/instructor/instructor_dashboard_2/instructor_dashboard_2.html @@ -1,6 +1,7 @@ <%! from django.utils.translation import ugettext as _ %> -<%inherit file="/main.html" /> <%! from django.core.urlresolvers import reverse %> + +<%inherit file="/main.html" /> <%namespace name='static' file='/static_content.html'/> ## ----- Tips on adding something to the new instructor dashboard ----- @@ -16,6 +17,8 @@ ## 5. Implement your standard django/python in lms/djangoapps/instructor/views/api.py ## 6. And tests go in lms/djangoapps/instructor/tests/ +<%block name="pagetitle">${_("Instructor Dashboard")} + <%block name="headextra"> <%static:css group='style-course-vendor'/> <%static:css group='style-course'/> diff --git a/lms/templates/instructor/staff_grading.html b/lms/templates/instructor/staff_grading.html index 09b41f91aa..dfec9af5f8 100644 --- a/lms/templates/instructor/staff_grading.html +++ b/lms/templates/instructor/staff_grading.html @@ -9,7 +9,7 @@ -<%block name="title">${_("{course_number} Staff Grading").format(course_number=course.display_number_with_default) | h} +<%block name="pagetitle">${_("{course_number} Staff Grading").format(course_number=course.display_number_with_default) | h} <%include file="/courseware/course_navigation.html" args="active_page='staff_grading'" /> diff --git a/lms/templates/login.html b/lms/templates/login.html index e8ddcd1b20..651d1be183 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -5,7 +5,7 @@ <%! from django.core.urlresolvers import reverse %> <%! from django.utils.translation import ugettext as _ %> -<%block name="title">${_("Log into your {platform_name} Account").format(platform_name=platform_name)} +<%block name="pagetitle">${_("Log into your {platform_name} Account").format(platform_name=platform_name)} <%block name="js_extra"> diff --git a/lms/templates/verify_student/photo_verification.html b/lms/templates/verify_student/photo_verification.html index 8e754452c0..f683ff905f 100644 --- a/lms/templates/verify_student/photo_verification.html +++ b/lms/templates/verify_student/photo_verification.html @@ -1,17 +1,16 @@ <%! from django.utils.translation import ugettext as _ %> <%! from django.core.urlresolvers import reverse %> + <%inherit file="../main.html" /> <%namespace name='static' file='/static_content.html'/> <%block name="bodyclass">register verification-process step-photos ${'is-upgrading' if upgrade else ''} -<%block name="title"> - +<%block name="pagetitle"> %if upgrade: ${_("Upgrade Your Registration for {} | Verification").format(course_name)} %else: ${_("Register for {} | Verification").format(course_name)} %endif - <%block name="js_extra"> diff --git a/lms/templates/verify_student/reverification_confirmation.html b/lms/templates/verify_student/reverification_confirmation.html index 5b2ee17333..47751edc5a 100644 --- a/lms/templates/verify_student/reverification_confirmation.html +++ b/lms/templates/verify_student/reverification_confirmation.html @@ -1,11 +1,11 @@ - <%! from django.utils.translation import ugettext as _ %> <%! from django.core.urlresolvers import reverse %> + <%inherit file="../main.html" /> <%namespace name='static' file='/static_content.html'/> <%block name="bodyclass">register verification-process is-not-verified step-confirmation -<%block name="title">${_("Re-Verification Submission Confirmation")} +<%block name="pagetitle">${_("Re-Verification Submission Confirmation")} <%block name="js_extra"> diff --git a/lms/templates/verify_student/show_requirements.html b/lms/templates/verify_student/show_requirements.html index ed9fa4747b..8660db36aa 100644 --- a/lms/templates/verify_student/show_requirements.html +++ b/lms/templates/verify_student/show_requirements.html @@ -1,15 +1,14 @@ <%! from django.utils.translation import ugettext as _ %> <%! from django.core.urlresolvers import reverse %> + <%inherit file="../main.html" /> <%block name="bodyclass">register verification-process step-requirements ${'is-upgrading' if upgrade else ''} -<%block name="title"> - +<%block name="pagetitle"> %if upgrade: ${_("Upgrade Your Registration for {}").format(course_name)} %else: ${_("Register for {}").format(course_name)} %endif - <%block name="content"> diff --git a/lms/templates/verify_student/verified.html b/lms/templates/verify_student/verified.html index 41b4b312b9..965fe498f1 100644 --- a/lms/templates/verify_student/verified.html +++ b/lms/templates/verify_student/verified.html @@ -1,10 +1,11 @@ <%! from django.utils.translation import ugettext as _ %> <%! from django.core.urlresolvers import reverse %> + <%inherit file="../main.html" /> <%namespace name='static' file='/static_content.html'/> <%block name="bodyclass">register verification-process is-verified -<%block name="title">${_("Register for {} | Verification").format(course_name)} +<%block name="pagetitle">${_("Register for {} | Verification").format(course_name)} <%block name="js_extra">