From eafb79defc803f8caefaf7938a4eb249b20bee1e Mon Sep 17 00:00:00 2001 From: Sarah Fischmann Date: Wed, 31 May 2017 16:56:46 -0400 Subject: [PATCH] Added lang attribute in LMS and Studio; added language col to course_overviews Added course level lang attribute for LMS added lang attribute to Studio fixed error when trying to get language attribute on course that does not exist simplified code added lang attribure to more places in LMS, added migration for language attribute in course_overview fixing contraints in the database for language attribute added lang attribute to several more places in LMS and Studio added lang attribute to discussion and custom pages; cleaned up code fixed issue that was causing test failures moved lang attribute higher in tree in two places --- cms/djangoapps/contentstore/views/preview.py | 5 ++++- cms/templates/course_info.html | 6 +++++- cms/templates/course_outline.html | 7 +++++-- cms/templates/studio_xblock_wrapper.html | 6 +++++- .../discussion/discussion_board_fragment.html | 6 +++++- lms/templates/courseware/courseware.html | 6 +++++- lms/templates/courseware/info.html | 6 +++++- lms/templates/courseware/progress.html | 6 +++++- lms/templates/courseware/static_tab.html | 5 +++++ .../dashboard/_dashboard_course_listing.html | 6 +++++- lms/templates/wiki/base.html | 6 +++++- .../0013_courseoverview_language.py | 19 +++++++++++++++++++ .../content/course_overviews/models.py | 4 ++++ 13 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 openedx/core/djangoapps/content/course_overviews/migrations/0013_courseoverview_language.py diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index 09e234d6ea..c33dd46380 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -282,6 +282,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False): selected_groups_label = get_visibility_partition_info(xblock)['selected_groups_label'] if selected_groups_label: selected_groups_label = _('Access restricted to: {list_of_groups}').format(list_of_groups=selected_groups_label) + course = modulestore().get_course(xblock.location.course_key) template_context = { 'xblock_context': context, 'xblock': xblock, @@ -293,8 +294,10 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False): 'can_edit_visibility': context.get('can_edit_visibility', True), 'selected_groups_label': selected_groups_label, 'can_add': context.get('can_add', True), - 'can_move': context.get('can_move', True) + 'can_move': context.get('can_move', True), + 'language': getattr(course, 'language', None) } + html = render_to_string('studio_xblock_wrapper.html', template_context) frag = wrap_fragment(frag, html) return frag diff --git a/cms/templates/course_info.html b/cms/templates/course_info.html index 4080ea7183..ed983c27a5 100644 --- a/cms/templates/course_info.html +++ b/cms/templates/course_info.html @@ -62,7 +62,11 @@ from openedx.core.djangolib.js_utils import (
-
+
    diff --git a/cms/templates/course_outline.html b/cms/templates/course_outline.html index 3cd55667b6..c4239b94b4 100644 --- a/cms/templates/course_outline.html +++ b/cms/templates/course_outline.html @@ -175,8 +175,11 @@ from openedx.core.djangolib.markup import HTML, Text
    % endif
    - -
    +
    <% course_locator = context_course.location %> diff --git a/cms/templates/studio_xblock_wrapper.html b/cms/templates/studio_xblock_wrapper.html index 420c54ae2f..27fd4427c3 100644 --- a/cms/templates/studio_xblock_wrapper.html +++ b/cms/templates/studio_xblock_wrapper.html @@ -158,7 +158,11 @@ messages = xblock.validate().to_json() % if show_preview: % if is_root or not xblock_url: -
    + % if not is_root and language: +
    + % else: +
    + % endif ${content | n, decode.utf8}
    % else: diff --git a/lms/djangoapps/discussion/templates/discussion/discussion_board_fragment.html b/lms/djangoapps/discussion/templates/discussion/discussion_board_fragment.html index f8f71ef129..94dc0052b2 100644 --- a/lms/djangoapps/discussion/templates/discussion/discussion_board_fragment.html +++ b/lms/djangoapps/discussion/templates/discussion/discussion_board_fragment.html @@ -41,7 +41,11 @@ from openedx.core.djangolib.markup import HTML
    -
    +