From 36917398c0842fae22de3c2b92bf95dc17cae741 Mon Sep 17 00:00:00 2001 From: Brian Jacobel Date: Fri, 8 Apr 2016 11:41:04 -0400 Subject: [PATCH 01/15] Revert "Introduce Pattern Library test pages" This reverts commit 845e3708f3ac3d58982a2a9d3e92acc4f17b35e3. --- cms/envs/common.py | 14 ++++++++++ cms/static/sass/_build-v2.scss | 9 ------- .../sass/{_build-v1.scss => _build.scss} | 1 - cms/static/sass/_config.scss | 7 ----- ...-main-v1-rtl.scss => studio-main-rtl.scss} | 2 +- cms/static/sass/studio-main-v2-rtl.scss | 14 ---------- cms/static/sass/studio-main-v2.scss | 14 ---------- .../{studio-main-v1.scss => studio-main.scss} | 5 ++-- cms/templates/base.html | 10 +------ cms/templates/ux/reference/index.html | 1 - .../ux/reference/pattern-library-test.html | 23 ---------------- common/djangoapps/pipeline_mako/__init__.py | 24 +---------------- .../templates/static_content.html | 4 +-- .../tests/test_comprehensive_theming.py | 8 +++--- lms/envs/common.py | 14 ++++++++++ lms/static/certificates/sass/_build.scss | 14 ++++++---- lms/static/certificates/sass/_config.scss | 4 +++ lms/static/certificates/sass/_lib.scss | 9 +++++++ lms/static/certificates/sass/_ltr.scss | 23 ++++++++++++++++ lms/static/certificates/sass/_rtl.scss | 23 ++++++++++++++++ lms/static/certificates/sass/main-ltr.scss | 17 +++++++----- lms/static/certificates/sass/main-rtl.scss | 17 +++++++----- lms/static/sass/_build-lms-v2.scss | 9 ------- .../{_build-lms-v1.scss => _build-lms.scss} | 0 lms/static/sass/_config.scss | 7 ----- ...lms-main-v1-rtl.scss => lms-main-rtl.scss} | 5 ++-- lms/static/sass/lms-main-v2-rtl.scss | 14 ---------- lms/static/sass/lms-main-v2.scss | 14 ---------- .../sass/{lms-main-v1.scss => lms-main.scss} | 5 ++-- lms/templates/main.html | 18 ++++++++----- lms/templates/ux/reference/index.html | 27 ------------------- .../ux/reference/pattern-library-test.html | 26 ------------------ .../tests/test_theme_style_overrides.py | 16 +++++------ package.json | 4 +-- pavelib/assets.py | 14 +++++----- pavelib/paver_tests/test_assets.py | 10 +++---- 36 files changed, 163 insertions(+), 263 deletions(-) delete mode 100644 cms/static/sass/_build-v2.scss rename cms/static/sass/{_build-v1.scss => _build.scss} (98%) delete mode 100644 cms/static/sass/_config.scss rename cms/static/sass/{studio-main-v1-rtl.scss => studio-main-rtl.scss} (88%) delete mode 100644 cms/static/sass/studio-main-v2-rtl.scss delete mode 100644 cms/static/sass/studio-main-v2.scss rename cms/static/sass/{studio-main-v1.scss => studio-main.scss} (76%) delete mode 100644 cms/templates/ux/reference/pattern-library-test.html create mode 100644 lms/static/certificates/sass/_lib.scss create mode 100644 lms/static/certificates/sass/_ltr.scss create mode 100644 lms/static/certificates/sass/_rtl.scss delete mode 100644 lms/static/sass/_build-lms-v2.scss rename lms/static/sass/{_build-lms-v1.scss => _build-lms.scss} (100%) delete mode 100644 lms/static/sass/_config.scss rename lms/static/sass/{lms-main-v1-rtl.scss => lms-main-rtl.scss} (78%) delete mode 100644 lms/static/sass/lms-main-v2-rtl.scss delete mode 100644 lms/static/sass/lms-main-v2.scss rename lms/static/sass/{lms-main-v1.scss => lms-main.scss} (76%) delete mode 100644 lms/templates/ux/reference/index.html delete mode 100644 lms/templates/ux/reference/pattern-library-test.html diff --git a/cms/envs/common.py b/cms/envs/common.py index d145920406..71389ff714 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -568,6 +568,20 @@ PIPELINE_CSS = { ], 'output_filename': 'css/cms-style-vendor-tinymce-skin.css', }, + 'style-main': { + # this is unnecessary and can be removed + 'source_filenames': [ + 'css/studio-main.css', + ], + 'output_filename': 'css/studio-main.css', + }, + 'style-main-rtl': { + # this is unnecessary and can be removed + 'source_filenames': [ + 'css/studio-main-rtl.css', + ], + 'output_filename': 'css/studio-main-rtl.css', + }, 'style-edx-icons': { 'source_filenames': [ 'css/edx-icons.css', diff --git a/cms/static/sass/_build-v2.scss b/cms/static/sass/_build-v2.scss deleted file mode 100644 index 2a032042f6..0000000000 --- a/cms/static/sass/_build-v2.scss +++ /dev/null @@ -1,9 +0,0 @@ -// ------------------------------ -// Studio: Shared Build Compile -// Version 2 - introduces the Pattern Library - - -// Configuration -@import 'config'; - -// Extensions diff --git a/cms/static/sass/_build-v1.scss b/cms/static/sass/_build.scss similarity index 98% rename from cms/static/sass/_build-v1.scss rename to cms/static/sass/_build.scss index f6770f4b9b..57a133fa83 100644 --- a/cms/static/sass/_build-v1.scss +++ b/cms/static/sass/_build.scss @@ -1,6 +1,5 @@ // ------------------------------ // Studio: Shared Build Compile -// Version 1 styling (pre-Pattern Library) // About: Sass compile for Studio that are shared between LTR and RTL UI. Configuration and vendor specific imports happen before this shared set of imports are compiled in the studio-main-*.scss files. diff --git a/cms/static/sass/_config.scss b/cms/static/sass/_config.scss deleted file mode 100644 index a1c263754b..0000000000 --- a/cms/static/sass/_config.scss +++ /dev/null @@ -1,7 +0,0 @@ -// ------------------------------ -// Studio configuration settings - - -// ------------------------------ -// #VARIABLES -// ------------------------------ diff --git a/cms/static/sass/studio-main-v1-rtl.scss b/cms/static/sass/studio-main-rtl.scss similarity index 88% rename from cms/static/sass/studio-main-v1-rtl.scss rename to cms/static/sass/studio-main-rtl.scss index 83150f3607..7bd76516bb 100644 --- a/cms/static/sass/studio-main-v1-rtl.scss +++ b/cms/static/sass/studio-main-rtl.scss @@ -17,4 +17,4 @@ @import 'bourbon/bourbon'; // lib - bourbon @import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages -@import 'build-v1'; // shared app style assets/rendering +@import 'build'; // shared app style assets/rendering diff --git a/cms/static/sass/studio-main-v2-rtl.scss b/cms/static/sass/studio-main-v2-rtl.scss deleted file mode 100644 index 9f0643502f..0000000000 --- a/cms/static/sass/studio-main-v2-rtl.scss +++ /dev/null @@ -1,14 +0,0 @@ -// ------------------------------ -// Studio main styling -// Version 2 - introduces the Pattern Library - -// NOTE: This is the right-to-left (RTL) configured style compile. -// It should mirror main-ltr w/ the exception of bi-app references. - - -// Load the RTL version of the edX Pattern Library -$pattern-library-path: '../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-rtl'; - -// Load the shared build -@import 'build-v2'; diff --git a/cms/static/sass/studio-main-v2.scss b/cms/static/sass/studio-main-v2.scss deleted file mode 100644 index cd355d5a7d..0000000000 --- a/cms/static/sass/studio-main-v2.scss +++ /dev/null @@ -1,14 +0,0 @@ -// ------------------------------ -// Studio main styling -// Version 2 - introduces the Pattern Library - -// NOTE: This is the left-to-right (LTR) configured style compile. -// It should mirror main-rtl w/ the exception of bi-app references. - - -// Load the LTR version of the edX Pattern Library -$pattern-library-path: '../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-ltr'; - -// Load the shared build -@import 'build-v2'; diff --git a/cms/static/sass/studio-main-v1.scss b/cms/static/sass/studio-main.scss similarity index 76% rename from cms/static/sass/studio-main-v1.scss rename to cms/static/sass/studio-main.scss index 4c40522015..00db34fabe 100644 --- a/cms/static/sass/studio-main-v1.scss +++ b/cms/static/sass/studio-main.scss @@ -1,5 +1,4 @@ -// Studio - css architecture -// Version 1 styling (pre-Pattern Library) +// studio - css architecture // ==================== // Table of Contents @@ -18,4 +17,4 @@ @import 'bourbon/bourbon'; // lib - bourbon @import 'vendor/bi-app/bi-app-ltr'; // set the layout for left to right languages -@import 'build-v1'; // shared app style assets/rendering +@import 'build'; // shared app style assets/rendering diff --git a/cms/templates/base.html b/cms/templates/base.html index c71e9cc6bc..8dc7502e10 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -1,10 +1,4 @@ ## coding=utf-8 - -## Pages currently use v1 styling by default. Once the Pattern Library -## rollout has been completed, this default can be switched to v2. -<%! main_css = "css/studio-main-v1.css" %> - -## Standard imports <%namespace name='static' file='static_content.html'/> <%! from django.utils.translation import ugettext as _ @@ -13,7 +7,6 @@ from openedx.core.djangolib.js_utils import ( dump_js_escaped_json, js_escaped_string ) %> - <%page expression_filter="h"/> @@ -43,8 +36,7 @@ from openedx.core.djangolib.js_utils import ( <%static:css group='style-vendor'/> <%static:css group='style-vendor-tinymce-content'/> <%static:css group='style-vendor-tinymce-skin'/> - - <%static:css group='${self.attr.main_css}'/> + <%static:css group='style-main'/> <%include file="widgets/segment-io.html" /> diff --git a/cms/templates/ux/reference/index.html b/cms/templates/ux/reference/index.html index 5f7c6d1aeb..4121778dcd 100644 --- a/cms/templates/ux/reference/index.html +++ b/cms/templates/ux/reference/index.html @@ -24,7 +24,6 @@ diff --git a/cms/templates/ux/reference/pattern-library-test.html b/cms/templates/ux/reference/pattern-library-test.html deleted file mode 100644 index 21ee51c129..0000000000 --- a/cms/templates/ux/reference/pattern-library-test.html +++ /dev/null @@ -1,23 +0,0 @@ -## Override the default styles_version to the Pattern Library version (version 2) -<%! main_css = "css/studio-main-v2.css" %> - -<%inherit file="../../base.html" /> - -<%block name="title">Pattern Library Test Page -<%block name="bodyclass">is-signedin pattern-library - -<%block name="content"> -

Warning Alert with Message Only

-
- -
- diff --git a/common/djangoapps/pipeline_mako/__init__.py b/common/djangoapps/pipeline_mako/__init__.py index 734c5d2e11..d8987550a4 100644 --- a/common/djangoapps/pipeline_mako/__init__.py +++ b/common/djangoapps/pipeline_mako/__init__.py @@ -10,7 +10,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage def compressed_css(package_name, raw=False): - package = pipeline_css_info(package_name) + package = settings.PIPELINE_CSS.get(package_name, {}) if package: package = {package_name: package} packager = Packager(css_packages=package, js_packages={}) @@ -24,28 +24,6 @@ def compressed_css(package_name, raw=False): return render_individual_css(package, paths, raw=raw) -def pipeline_css_info(package_name): - """ - Returns information about a CSS package needed for the Django pipeline. - - Note: if the package name was not registered, then the information - returned is based on the package_name being a relative path to a - single CSS file. - - Args: - package_name: The name of the CSS package. - - Returns: - A dictionary with information about the CSS package. - """ - if package_name in settings.PIPELINE_CSS: - return settings.PIPELINE_CSS[package_name] - return { - 'source_filenames': [package_name], - 'output_filename': package_name, - } - - def render_css(package, path, raw=False): template_name = package.template_name or "mako/css.html" context = package.extra_context diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html index 00a0c0dd16..9a2754f892 100644 --- a/common/djangoapps/pipeline_mako/templates/static_content.html +++ b/common/djangoapps/pipeline_mako/templates/static_content.html @@ -1,6 +1,6 @@ <%! from django.contrib.staticfiles.storage import staticfiles_storage -from pipeline_mako import compressed_css, compressed_js, pipeline_css_info +from pipeline_mako import compressed_css, compressed_js from django.utils.translation import get_language_bidi from mako.exceptions import TemplateLookupException @@ -40,7 +40,7 @@ except: % if settings.PIPELINE_ENABLED: ${compressed_css(group, raw=raw)} % else: - % for filename in pipeline_css_info(group)['source_filenames']: + % for filename in settings.PIPELINE_CSS[group]['source_filenames']: % endfor %endif diff --git a/lms/djangoapps/courseware/tests/test_comprehensive_theming.py b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py index dcc8d10485..54ef5ff84f 100644 --- a/lms/djangoapps/courseware/tests/test_comprehensive_theming.py +++ b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py @@ -104,8 +104,8 @@ class TestComprehensiveTheming(TestCase): """ Test that static files finders are adjusted according to the applied comprehensive theme. """ - result = staticfiles.finders.find('red-theme/css/lms-main-v1.css') - self.assertEqual(result, settings.REPO_ROOT / "themes/red-theme/lms/static/css/lms-main-v1.css") + result = staticfiles.finders.find('red-theme/css/lms-main.css') + self.assertEqual(result, settings.REPO_ROOT / "themes/red-theme/lms/static/css/lms-main.css") lms_main_css = "" with open(result) as css_file: @@ -117,8 +117,8 @@ class TestComprehensiveTheming(TestCase): """ Test default css is served if no theme is applied """ - result = staticfiles.finders.find('css/lms-main-v1.css') - self.assertEqual(result, settings.REPO_ROOT / "lms/static/css/lms-main-v1.css") + result = staticfiles.finders.find('css/lms-main.css') + self.assertEqual(result, settings.REPO_ROOT / "lms/static/css/lms-main.css") lms_main_css = "" with open(result) as css_file: diff --git a/lms/envs/common.py b/lms/envs/common.py index e5dd407e2d..6c84403569 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1390,6 +1390,20 @@ PIPELINE_CSS = { ], 'output_filename': 'css/lms-style-vendor-tinymce-skin.css', }, + 'style-main': { + # this is unnecessary and can be removed + 'source_filenames': [ + 'css/lms-main.css', + ], + 'output_filename': 'css/lms-main.css', + }, + 'style-main-rtl': { + # this is unnecessary and can be removed + 'source_filenames': [ + 'css/lms-main-rtl.css', + ], + 'output_filename': 'css/lms-main-rtl.css', + }, 'style-course-vendor': { 'source_filenames': [ 'js/vendor/CodeMirror/codemirror.css', diff --git a/lms/static/certificates/sass/_build.scss b/lms/static/certificates/sass/_build.scss index 11bd2e9947..c97b1b0c37 100644 --- a/lms/static/certificates/sass/_build.scss +++ b/lms/static/certificates/sass/_build.scss @@ -1,15 +1,19 @@ // ------------------------------ // Open edX Certificates: Shared Build Compile -// About: Sass compile for Open edX Certificates elements that are shared between LTR and RTL UI. -// Configuration and vendor specific imports happen before this shared set of imports are compiled -// in the main-*.scss files. +// About: Sass compile for Open edX Certificates elements that are shared between LTR and RTL UI. Configuration and vendor specific imports happen before this shared set of imports are compiled in the main-*.scss files. -// Configuration +// ------------------------------ +// #CONFIG + LIB +// ------------------------------ +@import 'lib'; @import 'config'; +@import '../../../../node_modules/edx-pattern-library/pattern-library/sass/edx-pattern-library'; -// Extensions +// ------------------------------ +// #EXTENSIONS +// ------------------------------ @import 'utilities'; @import 'base'; @import 'components'; diff --git a/lms/static/certificates/sass/_config.scss b/lms/static/certificates/sass/_config.scss index 911c68dd9a..d8e3a022d5 100644 --- a/lms/static/certificates/sass/_config.scss +++ b/lms/static/certificates/sass/_config.scss @@ -1,10 +1,14 @@ // ------------------------------ // Open edX Certificates: Config +// About: variable and configuration overrides + +// #VARIABLES // ------------------------------ // #VARIABLES // ------------------------------ +$pattern-library-path: '../../edx-pattern-library' !default; // certificate characteristics $cert-base-color: palette(grayscale-cool, dark); diff --git a/lms/static/certificates/sass/_lib.scss b/lms/static/certificates/sass/_lib.scss new file mode 100644 index 0000000000..83b0a55882 --- /dev/null +++ b/lms/static/certificates/sass/_lib.scss @@ -0,0 +1,9 @@ +// ------------------------------ +// Open edX Certificates: Main Style Compile + +// About: third party libraries and dependencies import + + +@import '../../../../node_modules/edx-pattern-library/node_modules/bourbon/app/assets/stylesheets/bourbon'; +@import '../../../../node_modules/edx-pattern-library/node_modules/susy/sass/susy'; +@import '../../../../node_modules/edx-pattern-library/node_modules/breakpoint-sass/stylesheets/breakpoint'; diff --git a/lms/static/certificates/sass/_ltr.scss b/lms/static/certificates/sass/_ltr.scss new file mode 100644 index 0000000000..392f53d3dd --- /dev/null +++ b/lms/static/certificates/sass/_ltr.scss @@ -0,0 +1,23 @@ +// ------------------------------ +// Open edX Certificates: Main Style Compile + +// About: Sass partial for defining settings and utilities for LTR-centric layouts. + +// #SETTINGS +// #LIB + + +// ---------------------------- +// #SETTINGS +// ---------------------------- +$layout-direction: ltr; + +// currently needed since platform Sass won't obey https://github.com/edx/ux-pattern-library/blob/master/pattern-library/sass/patterns/_grid.scss#L23 +$grid-direction-default: ltr; +$grid-direction-reversed: ltr; + + +// ---------------------------- +// #LIB +// ---------------------------- +@import '../../../../node_modules/edx-pattern-library/node_modules/bi-app-sass/bi-app/bi-app-ltr'; diff --git a/lms/static/certificates/sass/_rtl.scss b/lms/static/certificates/sass/_rtl.scss new file mode 100644 index 0000000000..ba219f69f8 --- /dev/null +++ b/lms/static/certificates/sass/_rtl.scss @@ -0,0 +1,23 @@ +// ------------------------------ +// Open edX Certificates: Main Style Compile + +// About: Sass partial for defining settings and utilities for LTR-centric layouts. + +// #SETTINGS +// #LIB + + +// ---------------------------- +// #SETTINGS +// ---------------------------- +$layout-direction: rtl; + +// currently needed since platform Sass won't obey https://github.com/edx/ux-pattern-library/blob/master/pattern-library/sass/patterns/_grid.scss#L23 +$grid-direction-default: rtl; +$grid-direction-reversed: ltr; + + +// ---------------------------- +// #LIB +// ---------------------------- +@import '../../../../node_modules/edx-pattern-library/node_modules/bi-app-sass/bi-app/bi-app-rtl'; diff --git a/lms/static/certificates/sass/main-ltr.scss b/lms/static/certificates/sass/main-ltr.scss index 41f638c2b4..db0e51c41e 100644 --- a/lms/static/certificates/sass/main-ltr.scss +++ b/lms/static/certificates/sass/main-ltr.scss @@ -3,13 +3,16 @@ // About: Sass compile for the Open edX Certificates Elements. -// NOTE: This is the left to right (LTR) configured style compile. -// It should mirror main-rtl w/ the exception of bi-app references. +// NOTE: This is the left to right (LTR) configured style compile. It should mirror main-rtl w/ the exception of bi-app references. -// Load the LTR version of the edX Pattern Library -$pattern-library-path: '../../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-ltr'; +// ------------------------------ +// #CONFIG - layout direction +// ------------------------------ +@import 'ltr'; // LTR-specifc settings and utilities -// Load the shared build -@import 'build'; + +// ------------------------------ +// #BUILD +// ------------------------------ +@import 'build'; // shared compile/build order for both LTR and RTL UI diff --git a/lms/static/certificates/sass/main-rtl.scss b/lms/static/certificates/sass/main-rtl.scss index faea15b67e..54a6ec443c 100644 --- a/lms/static/certificates/sass/main-rtl.scss +++ b/lms/static/certificates/sass/main-rtl.scss @@ -3,13 +3,16 @@ // About: Sass compile for the Open edX Certificates Elements. -// NOTE: This is the right to left (RTL) configured style compile. -// It should mirror main-ltr w/ the exception of bi-app references. +// NOTE: This is the right to left (RTL) configured style compile. It should mirror main-ltr w/ the exception of bi-app references. -// Load the RTL version of the edX Pattern Library -$pattern-library-path: '../../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-rtl'; +// ------------------------------ +// #CONFIG - layout direction +// ------------------------------ +@import 'rtl'; // RTL-specifc settings and utilities -// Load the shared build -@import 'build'; + +// ------------------------------ +// #BUILD +// ------------------------------ +@import 'build'; // shared compile/build order for both LTR and RTL UI diff --git a/lms/static/sass/_build-lms-v2.scss b/lms/static/sass/_build-lms-v2.scss deleted file mode 100644 index a982b28c2a..0000000000 --- a/lms/static/sass/_build-lms-v2.scss +++ /dev/null @@ -1,9 +0,0 @@ -// ------------------------------ -// LMS: Shared Build Compile -// Version 2 - introduces the Pattern Library - - -// Configuration -@import 'config'; - -// Extensions diff --git a/lms/static/sass/_build-lms-v1.scss b/lms/static/sass/_build-lms.scss similarity index 100% rename from lms/static/sass/_build-lms-v1.scss rename to lms/static/sass/_build-lms.scss diff --git a/lms/static/sass/_config.scss b/lms/static/sass/_config.scss deleted file mode 100644 index e3a6ab63c1..0000000000 --- a/lms/static/sass/_config.scss +++ /dev/null @@ -1,7 +0,0 @@ -// ------------------------------ -// LMS configuration settings - - -// ------------------------------ -// #VARIABLES -// ------------------------------ diff --git a/lms/static/sass/lms-main-v1-rtl.scss b/lms/static/sass/lms-main-rtl.scss similarity index 78% rename from lms/static/sass/lms-main-v1-rtl.scss rename to lms/static/sass/lms-main-rtl.scss index 0988836b42..7ab3e3cd35 100644 --- a/lms/static/sass/lms-main-v1-rtl.scss +++ b/lms/static/sass/lms-main-rtl.scss @@ -1,5 +1,4 @@ -// LMS - CSS application architecture -// Version 1 styling (pre-Pattern Library) +// lms - css application architecture // ==================== // libs and resets *do not edit* @@ -19,4 +18,4 @@ // theme, for old-style deprecated theming. // -@import 'build-lms-v1'; // shared app style assets/rendering +@import 'build-lms'; // shared app style assets/rendering diff --git a/lms/static/sass/lms-main-v2-rtl.scss b/lms/static/sass/lms-main-v2-rtl.scss deleted file mode 100644 index 195b752386..0000000000 --- a/lms/static/sass/lms-main-v2-rtl.scss +++ /dev/null @@ -1,14 +0,0 @@ -// ------------------------------ -// LMS main styling -// Version 2 - introduces the Pattern Library - -// NOTE: This is the right-to-left (RTL) configured style compile. -// It should mirror lms-main-v2 w/ the exception of bi-app references. - - -// Load the RTL version of the edX Pattern Library -$pattern-library-path: '../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-rtl'; - -// Load the shared build -@import 'build-lms-v2'; diff --git a/lms/static/sass/lms-main-v2.scss b/lms/static/sass/lms-main-v2.scss deleted file mode 100644 index ca43dfc041..0000000000 --- a/lms/static/sass/lms-main-v2.scss +++ /dev/null @@ -1,14 +0,0 @@ -// ------------------------------ -// LMS main styling -// Version 2 - introduces the Pattern Library - -// NOTE: This is the left-to-right (LTR) configured style compile. -// It should mirror lms-main-v2-rtl w/ the exception of bi-app references. - - -// Load the RTL version of the edX Pattern Library -$pattern-library-path: '../edx-pattern-library' !default; -@import 'edx-pattern-library/pattern-library/sass/edx-pattern-library-ltr'; - -// Load the shared build -@import 'build-lms-v2'; diff --git a/lms/static/sass/lms-main-v1.scss b/lms/static/sass/lms-main.scss similarity index 76% rename from lms/static/sass/lms-main-v1.scss rename to lms/static/sass/lms-main.scss index ca36fb3acb..1a79ca0442 100644 --- a/lms/static/sass/lms-main-v1.scss +++ b/lms/static/sass/lms-main.scss @@ -1,5 +1,4 @@ -// LMS - CSS application architecture -// Version 1 styling (pre-Pattern Library) +// lms - css application architecture // ==================== // libs and resets *do not edit* @@ -18,4 +17,4 @@ // theme, for old-style deprecated theming. // -@import 'build-lms-v1'; // shared app style assets/rendering +@import 'build-lms'; // shared app style assets/rendering diff --git a/lms/templates/main.html b/lms/templates/main.html index 8f04585647..827e578234 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -1,10 +1,4 @@ ## coding=utf-8 - -## Pages currently use v1 styling by default. Once the Pattern Library -## rollout has been completed, this default can be switched to v2. -<%! main_css = "css/lms-main-v1.css" %> - - <%namespace name='static' file='static_content.html'/> <%! from django.core.urlresolvers import reverse @@ -55,7 +49,17 @@ from pipeline_mako import render_require_js_path_overrides <%static:css group='style-vendor'/> - <%static:css group='${self.attr.main_css}'/> + ## We could do <%static:css group='style-main'/>, but that's only useful + ## if the group contains multiple files, and the 'style-main' group doesn't. + ## Instead, we'll construct this element manually, to improve clarity. + ## When nothing in the system is referencing the 'style-main' group, it can + ## be removed from the environment file. + <% + application_css_path = "css/lms-main{rtl}.css".format( + rtl="-rtl" if get_language_bidi() else "", + ) + %> + % if disable_courseware_js: <%static:js group='base_vendor'/> diff --git a/lms/templates/ux/reference/index.html b/lms/templates/ux/reference/index.html deleted file mode 100644 index e4ce1d1142..0000000000 --- a/lms/templates/ux/reference/index.html +++ /dev/null @@ -1,27 +0,0 @@ -<%page expression_filter="h"/> -<%inherit file="/main.html" /> -<%namespace name='static' file='/static_content.html'/> - -<%block name="pagetitle">UX Reference -<%block name="nav_skip">#content - -<%block name="bodyclass">view-ux-reference - -<%block name="content"> -
-
-
- -
-
-
- diff --git a/lms/templates/ux/reference/pattern-library-test.html b/lms/templates/ux/reference/pattern-library-test.html deleted file mode 100644 index 4a33fa56c8..0000000000 --- a/lms/templates/ux/reference/pattern-library-test.html +++ /dev/null @@ -1,26 +0,0 @@ -## Override the default styles_version to the Pattern Library version (version 2) -<%! main_css = "css/lms-main-v2.css" %> - -<%page expression_filter="h"/> -<%inherit file="/main.html" /> - -<%block name="pagetitle">Pattern Library Test -<%block name="nav_skip">#content - -<%block name="bodyclass">pattern-library - -<%block name="content"> -

Warning Alert with Message Only

-
- -
- diff --git a/openedx/core/djangoapps/theming/tests/test_theme_style_overrides.py b/openedx/core/djangoapps/theming/tests/test_theme_style_overrides.py index defc250276..b7852249d9 100644 --- a/openedx/core/djangoapps/theming/tests/test_theme_style_overrides.py +++ b/openedx/core/djangoapps/theming/tests/test_theme_style_overrides.py @@ -63,8 +63,8 @@ class TestComprehensiveThemeLMS(TestCase): """ Test that theme sass files are used instead of default sass files. """ - result = staticfiles.finders.find('test-theme/css/lms-main-v1.css') - self.assertEqual(result, settings.TEST_THEME / "lms/static/css/lms-main-v1.css") + result = staticfiles.finders.find('test-theme/css/lms-main.css') + self.assertEqual(result, settings.TEST_THEME / "lms/static/css/lms-main.css") lms_main_css = "" with open(result) as css_file: @@ -115,8 +115,8 @@ class TestComprehensiveThemeCMS(TestCase): """ Test that theme sass files are used instead of default sass files. """ - result = staticfiles.finders.find('test-theme/css/studio-main-v1.css') - self.assertEqual(result, settings.TEST_THEME / "cms/static/css/studio-main-v1.css") + result = staticfiles.finders.find('test-theme/css/studio-main.css') + self.assertEqual(result, settings.TEST_THEME / "cms/static/css/studio-main.css") cms_main_css = "" with open(result) as css_file: @@ -161,8 +161,8 @@ class TestComprehensiveThemeDisabledLMS(TestCase): """ Test that default css files served without comprehensive themes applied. """ - result = staticfiles.finders.find('css/lms-main-v1.css') - self.assertEqual(result, settings.REPO_ROOT / "lms/static/css/lms-main-v1.css") + result = staticfiles.finders.find('css/lms-main.css') + self.assertEqual(result, settings.REPO_ROOT / "lms/static/css/lms-main.css") lms_main_css = "" with open(result) as css_file: @@ -208,8 +208,8 @@ class TestComprehensiveThemeDisabledCMS(TestCase): """ Test that default css files served without comprehensive themes applied.. """ - result = staticfiles.finders.find('css/studio-main-v1.css') - self.assertEqual(result, settings.REPO_ROOT / "cms/static/css/studio-main-v1.css") + result = staticfiles.finders.find('css/studio-main.css') + self.assertEqual(result, settings.REPO_ROOT / "cms/static/css/studio-main.css") cms_main_css = "" with open(result) as css_file: diff --git a/package.json b/package.json index 35cc6a9829..5b9cffa68b 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.1.0", "dependencies": { "coffee-script": "1.6.1", - "edx-pattern-library": "~0.12.1", - "edx-ui-toolkit": "~0.9.1", + "edx-pattern-library": "0.10.4", + "edx-ui-toolkit": "0.9.0", "requirejs": "~2.1.22", "uglify-js": "2.4.24", "underscore": "~1.8.3", diff --git a/pavelib/assets.py b/pavelib/assets.py index 78c249b2df..3124979c6f 100644 --- a/pavelib/assets.py +++ b/pavelib/assets.py @@ -33,12 +33,9 @@ SYSTEMS = { } # Common lookup paths that are added to the lookup paths for all sass compilations -COMMON_LOOKUP_PATHS = [ +COMMON_LOOKUP_DIRS = [ path("common/static"), path("common/static/sass"), - path("node_modules"), - path("node_modules/edx-pattern-library/node_modules"), - ] # A list of NPM installed libraries that should be copied into the common @@ -111,7 +108,10 @@ def get_common_sass_directories(): applicable_directories.append({ "sass_source_dir": path("common/static/sass"), "css_destination_dir": path("common/static/css"), - "lookup_paths": COMMON_LOOKUP_PATHS, + "lookup_paths": [ + path("common/static"), + path("common/static/sass"), + ], }) return applicable_directories @@ -223,7 +223,7 @@ def get_watcher_dirs(themes_base_dir=None, themes=None): (list): dirs that need to be added to sass watchers. """ dirs = [] - dirs.extend(COMMON_LOOKUP_PATHS) + dirs.extend(COMMON_LOOKUP_DIRS) if themes_base_dir and themes: # Register sass watchers for all the given themes theme_dirs = [(path(themes_base_dir) / theme) for theme in themes if theme] @@ -559,7 +559,7 @@ def _compile_sass(system, theme, debug, force, timing_info): else: sass.compile( dirname=(sass_source_dir, css_dir), - include_paths=COMMON_LOOKUP_PATHS + lookup_paths, + include_paths=COMMON_LOOKUP_DIRS + lookup_paths, source_comments=source_comments, output_style=output_style, ) diff --git a/pavelib/paver_tests/test_assets.py b/pavelib/paver_tests/test_assets.py index ede0949ca1..4f6f211615 100644 --- a/pavelib/paver_tests/test_assets.py +++ b/pavelib/paver_tests/test_assets.py @@ -148,8 +148,6 @@ class TestPaverWatchAssetTasks(TestCase): self.expected_sass_directories = [ path('common/static/sass'), path('common/static'), - path('node_modules'), - path('node_modules/edx-pattern-library/node_modules'), path('lms/static/sass/partials'), path('lms/static/sass'), path('lms/static/certificates/sass'), @@ -158,10 +156,6 @@ class TestPaverWatchAssetTasks(TestCase): ] super(TestPaverWatchAssetTasks, self).setUp() - def tearDown(self): - self.expected_sass_directories = [] - super(TestPaverWatchAssetTasks, self).tearDown() - def test_watch_assets(self): """ Test the "compile_sass" task. @@ -204,3 +198,7 @@ class TestPaverWatchAssetTasks(TestCase): self.assertIsInstance(sass_watcher_args[0], PollingObserver) self.assertIsInstance(sass_watcher_args[1], list) self.assertItemsEqual(sass_watcher_args[1], self.expected_sass_directories) + + def tearDown(self): + self.expected_sass_directories = [] + super(TestPaverWatchAssetTasks, self).tearDown() From 3592819720f9465795906dde99a7c742cdde4e3d Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Fri, 8 Apr 2016 14:48:43 -0400 Subject: [PATCH 02/15] Update migration to add a dependency. Because this migration depends on enrollment code and that code relies on a new table. --- .../ccx/migrations/0003_add_master_course_staff_in_ccx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py b/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py index c97449a77b..0c3a5770c7 100644 --- a/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py +++ b/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py @@ -65,6 +65,7 @@ class Migration(migrations.Migration): ('ccx', '0001_initial'), ('ccx', '0002_customcourseforedx_structure_json'), ('course_overviews','0010_auto_20160329_2317'), # because we use course overview and are in the same release as that table is modified + ('verified_track_content','0001_initial'), # because we use enrollement code and are in the same release as an enrollement related table is created ] operations = [ From 7d43e3994ce5a37e86ec9802868bd6caf0895862 Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Thu, 7 Apr 2016 14:22:31 -0400 Subject: [PATCH 03/15] Fix sequence navigation issues for CCX courses MA-2258 --- .../xmodule/xmodule/modulestore/__init__.py | 5 +++++ .../lib/xmodule/xmodule/modulestore/mixed.py | 8 ++++---- .../xmodule/xmodule/modulestore/mongo/base.py | 2 ++ .../xmodule/modulestore/tests/test_mongo.py | 4 ++-- lms/djangoapps/ccx/modulestore.py | 13 ++++++++---- lms/djangoapps/ccx/tests/test_views.py | 20 ++++++++++++------- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py index a23ae9770b..4d2b3ae714 100644 --- a/common/lib/xmodule/xmodule/modulestore/__init__.py +++ b/common/lib/xmodule/xmodule/modulestore/__init__.py @@ -38,6 +38,11 @@ new_contract('XBlock', XBlock) LIBRARY_ROOT = 'library.xml' COURSE_ROOT = 'course.xml' +# List of names of computed fields on xmodules that are of type usage keys. +# This list can be used to determine which fields need to be stripped of +# extraneous usage key data when entering/exiting modulestores. +XMODULE_FIELDS_WITH_USAGE_KEYS = ['location', 'parent'] + class ModuleStoreEnum(object): """ diff --git a/common/lib/xmodule/xmodule/modulestore/mixed.py b/common/lib/xmodule/xmodule/modulestore/mixed.py index e104e1b0f2..adceb85aa6 100644 --- a/common/lib/xmodule/xmodule/modulestore/mixed.py +++ b/common/lib/xmodule/xmodule/modulestore/mixed.py @@ -17,8 +17,7 @@ from opaque_keys.edx.locator import LibraryLocator from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.assetstore import AssetMetadata -from . import ModuleStoreWriteBase -from . import ModuleStoreEnum +from . import ModuleStoreWriteBase, ModuleStoreEnum, XMODULE_FIELDS_WITH_USAGE_KEYS from .exceptions import ItemNotFoundError, DuplicateCourseError from .draft_and_published import ModuleStoreDraftAndPublished from .split_migrator import SplitMigrator @@ -67,8 +66,9 @@ def strip_key(func): retval = retval.version_agnostic() if rem_branch and hasattr(retval, 'for_branch'): retval = retval.for_branch(None) - if hasattr(retval, 'location'): - retval.location = strip_key_func(retval.location) + for field_name in XMODULE_FIELDS_WITH_USAGE_KEYS: + if hasattr(retval, field_name): + setattr(retval, field_name, strip_key_func(getattr(retval, field_name))) return retval # function for stripping both, collection of, and individual, values diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py index 161899f968..5cf793325b 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py @@ -127,6 +127,8 @@ class MongoKeyValueStore(InheritanceKeyValueStore): def set(self, key, value): if key.scope == Scope.children: self._children = value + elif key.scope == Scope.parent: + self._parent = value elif key.scope == Scope.settings: self._metadata[key.field_name] = value elif key.scope == Scope.content: diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py index 2965b2e5ca..be8e6c2f12 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py @@ -767,15 +767,15 @@ class TestMongoKeyValueStore(unittest.TestCase): def test_write(self): yield (self._check_write, KeyValueStore.Key(Scope.content, None, None, 'foo'), 'new_data') yield (self._check_write, KeyValueStore.Key(Scope.children, None, None, 'children'), []) + yield (self._check_write, KeyValueStore.Key(Scope.children, None, None, 'parent'), None) yield (self._check_write, KeyValueStore.Key(Scope.settings, None, None, 'meta'), 'new_settings') - # write Scope.parent raises InvalidScope, which is covered in test_write_invalid_scope def test_write_non_dict_data(self): self.kvs = MongoKeyValueStore('xml_data', self.parent, self.children, self.metadata) self._check_write(KeyValueStore.Key(Scope.content, None, None, 'data'), 'new_data') def test_write_invalid_scope(self): - for scope in (Scope.preferences, Scope.user_info, Scope.user_state, Scope.parent): + for scope in (Scope.preferences, Scope.user_info, Scope.user_state): with assert_raises(InvalidScopeError): self.kvs.set(KeyValueStore.Key(scope, None, None, 'foo'), 'new_value') diff --git a/lms/djangoapps/ccx/modulestore.py b/lms/djangoapps/ccx/modulestore.py index e4ac651cf0..6d99f6e797 100644 --- a/lms/djangoapps/ccx/modulestore.py +++ b/lms/djangoapps/ccx/modulestore.py @@ -13,6 +13,7 @@ from contextlib import contextmanager from functools import partial from ccx_keys.locator import CCXLocator, CCXBlockUsageLocator from opaque_keys.edx.locator import CourseLocator, BlockUsageLocator +from xmodule.modulestore import XMODULE_FIELDS_WITH_USAGE_KEYS def strip_ccx(val): @@ -28,8 +29,11 @@ def strip_ccx(val): elif isinstance(retval, CCXBlockUsageLocator): ccx_id = retval.course_key.ccx retval = retval.to_block_locator() - elif hasattr(retval, 'location'): - retval.location, ccx_id = strip_ccx(retval.location) + else: + for field_name in XMODULE_FIELDS_WITH_USAGE_KEYS: + if hasattr(retval, field_name): + stripped_field_value, ccx_id = strip_ccx(getattr(retval, field_name)) + setattr(retval, field_name, stripped_field_value) return retval, ccx_id @@ -43,8 +47,9 @@ def restore_ccx(val, ccx_id): elif isinstance(val, BlockUsageLocator): ccx_key = restore_ccx(val.course_key, ccx_id) val = CCXBlockUsageLocator(ccx_key, val.block_type, val.block_id) - if hasattr(val, 'location'): - val.location = restore_ccx(val.location, ccx_id) + for field_name in XMODULE_FIELDS_WITH_USAGE_KEYS: + if hasattr(val, field_name): + setattr(val, field_name, restore_ccx(getattr(val, field_name), ccx_id)) if hasattr(val, 'children'): val.children = restore_ccx_collection(val.children, ccx_id) return val diff --git a/lms/djangoapps/ccx/tests/test_views.py b/lms/djangoapps/ccx/tests/test_views.py index ecf7419311..be911f91a9 100644 --- a/lms/djangoapps/ccx/tests/test_views.py +++ b/lms/djangoapps/ccx/tests/test_views.py @@ -53,6 +53,7 @@ from xmodule.modulestore.tests.django_utils import ( from xmodule.modulestore.tests.factories import ( CourseFactory, ItemFactory, + SampleCourseFactory, ) from ccx_keys.locator import CCXLocator @@ -1049,9 +1050,9 @@ class CCXCoachTabTestCase(SharedModuleStoreTestCase): ) -class TestStudentDashboardWithCCX(ModuleStoreTestCase): +class TestStudentViewsWithCCX(ModuleStoreTestCase): """ - Test to ensure that the student dashboard works for users enrolled in CCX + Test to ensure that the student dashboard and courseware works for users enrolled in CCX courses. """ @@ -1059,13 +1060,13 @@ class TestStudentDashboardWithCCX(ModuleStoreTestCase): """ Set up courses and enrollments. """ - super(TestStudentDashboardWithCCX, self).setUp() + super(TestStudentViewsWithCCX, self).setUp() # Create a Draft Mongo and a Split Mongo course and enroll a student user in them. self.student_password = "foobar" self.student = UserFactory.create(username="test", password=self.student_password, is_staff=False) - self.draft_course = CourseFactory.create(default_store=ModuleStoreEnum.Type.mongo) - self.split_course = CourseFactory.create(default_store=ModuleStoreEnum.Type.split) + self.draft_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.mongo) + self.split_course = SampleCourseFactory.create(default_store=ModuleStoreEnum.Type.split) CourseEnrollment.enroll(self.student, self.draft_course.id) CourseEnrollment.enroll(self.student, self.split_course.id) @@ -1078,11 +1079,16 @@ class TestStudentDashboardWithCCX(ModuleStoreTestCase): self.ccx = CcxFactory(course_id=self.split_course.id, coach=self.coach) last_week = datetime.datetime.now(UTC()) - datetime.timedelta(days=7) override_field_for_ccx(self.ccx, self.split_course, 'start', last_week) # Required by self.ccx.has_started(). - course_key = CCXLocator.from_course_locator(self.split_course.id, self.ccx.id) - CourseEnrollment.enroll(self.student, course_key) + self.ccx_course_key = CCXLocator.from_course_locator(self.split_course.id, self.ccx.id) + CourseEnrollment.enroll(self.student, self.ccx_course_key) def test_load_student_dashboard(self): self.client.login(username=self.student.username, password=self.student_password) response = self.client.get(reverse('dashboard')) self.assertEqual(response.status_code, 200) self.assertTrue(re.search('Test CCX', response.content)) + + def test_load_courseware(self): + self.client.login(username=self.student.username, password=self.student_password) + response = self.client.get(reverse('courseware', kwargs={'course_id': unicode(self.ccx_course_key)})) + self.assertEqual(response.status_code, 200) From f4208e7c58828a4a97e34433e20ecf7add5e741d Mon Sep 17 00:00:00 2001 From: Bill DeRusha Date: Mon, 11 Apr 2016 11:53:52 -0400 Subject: [PATCH 04/15] Revert "Safe Templatize: wiki templates" This reverts commit e6edba18b43a6779e9d424f1d470258828b9daa6. --- lms/templates/wiki/includes/article_menu.html | 12 +++++------- lms/templates/wiki/includes/breadcrumbs.html | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lms/templates/wiki/includes/article_menu.html b/lms/templates/wiki/includes/article_menu.html index 89909a168e..7768d84989 100644 --- a/lms/templates/wiki/includes/article_menu.html +++ b/lms/templates/wiki/includes/article_menu.html @@ -1,9 +1,7 @@ ## mako -<%page expression_filter="h"/> <%! from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ - from openedx.core.djangolib.markup import Text, HTML from wiki.core.permissions import can_change_permissions %> @@ -11,7 +9,7 @@ ${_("View")} - ${Text(_("{span_start}(active){span_end}")).format(span_start=HTML(""), span_end=HTML("")) if selected_tab == "view" else ""} + ${_("{span_start}(active){span_end}").format(span_start="", span_end="") if selected_tab == "view" else ""} @@ -20,7 +18,7 @@ ${_("Edit")} - ${Text(_("{span_start}(active){span_end}")).format(span_start=HTML(""), span_end=HTML("")) if selected_tab == "edit" else ""} + ${_("{span_start}(active){span_end}").format(span_start="", span_end="") if selected_tab == "edit" else ""} %endif @@ -29,7 +27,7 @@ ${_("Changes")} - ${Text(_("{span_start}(active){span_end}")).format(span_start=HTML(""), span_end=HTML("")) if selected_tab == "history" else ""} + ${_("{span_start}(active){span_end}").format(span_start="", span_end="") if selected_tab == "history" else ""} @@ -39,7 +37,7 @@ ${plugin.article_tab[0]} - ${Text(_("{span_start}(active){span_end}")).format(span_start=HTML(""), span_end=HTML("")) if selected_tab == plugin.slug else ""} + ${_("{span_start}(active){span_end}").format(span_start="", span_end="") if selected_tab == plugin.slug else ""} %endif @@ -55,7 +53,7 @@ ${_("This should be enabled for all non-anonymous users once the notifications a ${_("Settings")} - ${Text(_("{span_start}active{span_end}")).format(span_start=HTML(""), span_end=HTML("")) if selected_tab == "settings" else ""} + ${_("{span_start}active{span_end}").format(span_start="(", span_end=")") if selected_tab == "settings" else ""} %endif diff --git a/lms/templates/wiki/includes/breadcrumbs.html b/lms/templates/wiki/includes/breadcrumbs.html index ee450c6f6a..d0152497ef 100644 --- a/lms/templates/wiki/includes/breadcrumbs.html +++ b/lms/templates/wiki/includes/breadcrumbs.html @@ -1,5 +1,4 @@ ## mako -<%page expression_filter="h"/> <%! from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ From 2d3a0346951ae5b8c4ce10126c5b068aa5a82610 Mon Sep 17 00:00:00 2001 From: Douglas Hall Date: Thu, 7 Apr 2016 16:00:12 -0400 Subject: [PATCH 05/15] Upgraded xblock-lti-consumer to 1.0.5 --- requirements/edx/github.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index 6a90d98ed1..a24663f7aa 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -90,7 +90,7 @@ git+https://github.com/edx/xblock-utils.git@v1.0.2#egg=xblock-utils==1.0.2 -e git+https://github.com/edx/edx-reverification-block.git@0.0.5#egg=edx-reverification-block==0.0.5 git+https://github.com/edx/edx-user-state-client.git@1.0.1#egg=edx-user-state-client==1.0.1 git+https://github.com/edx/edx-proctoring.git@0.12.15#egg=edx-proctoring==0.12.15 -git+https://github.com/edx/xblock-lti-consumer.git@v1.0.4#egg=xblock-lti-consumer==1.0.4 +git+https://github.com/edx/xblock-lti-consumer.git@v1.0.5#egg=xblock-lti-consumer==1.0.5 # Third Party XBlocks -e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga From d6ba8839bf7bb6484a0e00b83ea46e146c0708d1 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Thu, 7 Apr 2016 16:59:23 -0400 Subject: [PATCH 06/15] Stripping auth querystring from S3 URLs We use S3 for a number of uploads. Boto, by default, includes a auth querystring on the returned URLs. Since these uploads are public, there is no need for this querystring. Additionally, the long length URLs cause problems when API consumers need to store the URLs. This commit resolves this problem by removing the auth querystring. - Updated to latest versions of boto and django-storages-redux packages - Added AWS_QUERYSTRING_AUTH setting to remove the querystring values ECOM-4081 --- cms/envs/aws.py | 4 ++++ lms/envs/aws.py | 4 ++++ requirements/edx/base.txt | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 0068221147..6755313593 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -274,6 +274,10 @@ AWS_SECRET_ACCESS_KEY = AUTH_TOKENS["AWS_SECRET_ACCESS_KEY"] if AWS_SECRET_ACCESS_KEY == "": AWS_SECRET_ACCESS_KEY = None +# Disabling querystring auth instructs Boto to exclude the querystring parameters (e.g. signature, access key) it +# normally appends to every returned URL. +AWS_QUERYSTRING_AUTH = AUTH_TOKENS.get('AWS_QUERYSTRING_AUTH', True) + if AUTH_TOKENS.get('DEFAULT_FILE_STORAGE'): DEFAULT_FILE_STORAGE = AUTH_TOKENS.get('DEFAULT_FILE_STORAGE') elif AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY: diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 22e178740e..c5ee1bd76c 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -442,6 +442,10 @@ if AWS_SECRET_ACCESS_KEY == "": AWS_STORAGE_BUCKET_NAME = AUTH_TOKENS.get('AWS_STORAGE_BUCKET_NAME', 'edxuploads') +# Disabling querystring auth instructs Boto to exclude the querystring parameters (e.g. signature, access key) it +# normally appends to every returned URL. +AWS_QUERYSTRING_AUTH = AUTH_TOKENS.get('AWS_QUERYSTRING_AUTH', True) + if AUTH_TOKENS.get('DEFAULT_FILE_STORAGE'): DEFAULT_FILE_STORAGE = AUTH_TOKENS.get('DEFAULT_FILE_STORAGE') elif AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY: diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index bfa8fe06bc..fde9802b44 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -8,7 +8,7 @@ beautifulsoup4==4.1.3 beautifulsoup==3.2.1 bleach==1.4 html5lib==0.999 -boto==2.32.1 +boto==2.39.0 celery==3.1.18 cssselect==0.9.1 dealer==2.0.4 @@ -28,7 +28,7 @@ django-sekizai==0.8.2 django-ses==0.7.0 django-simple-history==1.6.3 django-statici18n==1.1.5 -django-storages-redux==1.3 +django-storages==1.4.1 django-method-override==0.1.0 # We need a fix to DRF 3.2.x, for now use it from our own cherry-picked repo #djangorestframework>=3.1,<3.2 From 8e591f63239beaa12c861a3575590c05b3dee8ae Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Fri, 8 Apr 2016 14:33:38 -0400 Subject: [PATCH 07/15] Fix Safe template issues (again) --- .../dashboard/_dashboard_course_listing.html | 17 ++++++++++++----- lms/templates/unsubscribe.html | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index de9e3184af..92ae61d505 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -8,6 +8,7 @@ from django.utils.translation import ungettext from django.core.urlresolvers import reverse from course_modes.models import CourseMode from course_modes.helpers import enrollment_mode_display +from openedx.core.djangolib.js_utils import dump_js_escaped_json from openedx.core.djangolib.markup import Text, HTML from student.helpers import ( VERIFY_STATUS_NEED_TO_VERIFY, @@ -317,7 +318,13 @@ from student.helpers import (

${_('Your verification will expire soon!')}

## Translators: start_link and end_link will be replaced with HTML tags; ## please do not translate these. -

${Text(_('Your current verification will expire before the verification deadline for this course. {start_link}Re-verify your identity now{end_link} using a webcam and a government-issued ID.')).format(start_link=HTML(''.format(href=reverse('verify_student_reverify'))), end_link=HTML(''))}

+

${Text(_('Your current verification will expire before the verification deadline ' + 'for this course. {start_link}Re-verify your identity now{end_link} using a webcam and a ' + 'government-issued ID.')).format( + start_link=HTML('').format(href=reverse('verify_student_reverify')), + end_link=HTML('') + )} +

% endif % endif @@ -334,10 +341,10 @@ from student.helpers import ( "It's a proven motivator to complete the course. {line_break}" "{link_start}Learn more about the verified {cert_name_long}{link_end}.")).format( line_break=HTML('
'), - link_start=HTML(''.format( + link_start=HTML('').format( marketing_link('WHAT_IS_VERIFIED_CERT'), enrollment.course_id - )), + ), link_end=HTML(''), cert_name_long=cert_name_long )} @@ -394,7 +401,7 @@ from student.helpers import (
  • ${Text(_("You must successfully complete {link_start}{prc_display}{link_end} before you begin this course.")).format( - link_start=HTML(''.format(prc_target)), + link_start=HTML('').format(prc_target), link_end=HTML(''), prc_display=course_requirements['courses'][0]['display'], )} @@ -409,7 +416,7 @@ from student.helpers import (