From 6d89cc1bd184f97162782ea70ded412fe0e2b7fd Mon Sep 17 00:00:00 2001 From: Harry Rein Date: Mon, 10 Jul 2017 15:21:05 -0400 Subject: [PATCH] Updating themes for bootstrap. LEARNER-1785 This story was to update the existing custom themes to work with the flexible bootstrap design. It also updates the red theme to more closely resemble the real implementation on openedx. --- .../tests/test_comprehensive_theming.py | 2 - lms/static/sass/bootstrap/_footer.scss | 2 +- lms/static/sass/bootstrap/_navigation.scss | 7 +- lms/static/sass/bootstrap/_variables.scss | 3 + ...{lms-main-bootstrap.scss => lms-main.scss} | 3 +- lms/static/sass/partials/README.rst | 4 + .../sass/partials/bootstrap/_theme.scss | 3 + lms/static/sass/shared-v2/_header.scss | 2 +- lms/static/sass/shared-v2/_variables.scss | 2 + lms/templates/navigation/navigation.html | 2 +- lms/templates/user_dropdown.html | 2 +- .../reference/bootstrap/course-skeleton.html | 6 +- .../sass/partials/bootstrap/_theme.scss | 3 + .../sass/partials/bootstrap/_theme.scss | 3 + themes/edx.org/lms/templates/header.html | 104 +++++++++- themes/red-theme/lms/static/images/logo.png | Bin 493 -> 5288 bytes .../static/sass/partials/base/_variables.scss | 17 +- .../sass/partials/bootstrap/_theme.scss | 13 ++ themes/red-theme/lms/templates/header.html | 179 +----------------- 19 files changed, 162 insertions(+), 195 deletions(-) rename lms/static/sass/bootstrap/{lms-main-bootstrap.scss => lms-main.scss} (85%) create mode 100644 lms/static/sass/partials/README.rst create mode 100644 lms/static/sass/partials/bootstrap/_theme.scss create mode 100644 themes/edge.edx.org/lms/static/sass/partials/bootstrap/_theme.scss create mode 100644 themes/edx.org/lms/static/sass/partials/bootstrap/_theme.scss create mode 100644 themes/red-theme/lms/static/sass/partials/bootstrap/_theme.scss diff --git a/lms/djangoapps/courseware/tests/test_comprehensive_theming.py b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py index f2e4e8137c..29790e8dba 100644 --- a/lms/djangoapps/courseware/tests/test_comprehensive_theming.py +++ b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py @@ -30,8 +30,6 @@ class TestComprehensiveTheming(TestCase): self.assertEqual(resp.status_code, 200) # This string comes from footer.html self.assertContains(resp, "super-ugly") - # This string comes from header.html - self.assertContains(resp, "This file is only for demonstration, and is horrendous!") def test_theme_outside_repo(self): # Need to create a temporary theme, and defer decorating the function diff --git a/lms/static/sass/bootstrap/_footer.scss b/lms/static/sass/bootstrap/_footer.scss index 035f4c11f5..2efbc43d81 100644 --- a/lms/static/sass/bootstrap/_footer.scss +++ b/lms/static/sass/bootstrap/_footer.scss @@ -4,7 +4,7 @@ .wrapper-footer { box-shadow: 0 -1px 5px 0 $black-t0; border-top: 1px solid $navbar-light-disabled-color; - background-color: $body-bg; + background-color: $footer-bg; margin-top: $baseline/2; padding: $baseline; font-family: $font-family-sans-serif; diff --git a/lms/static/sass/bootstrap/_navigation.scss b/lms/static/sass/bootstrap/_navigation.scss index 7564c70bcc..055d8d0eca 100644 --- a/lms/static/sass/bootstrap/_navigation.scss +++ b/lms/static/sass/bootstrap/_navigation.scss @@ -2,6 +2,7 @@ .navigation-container { border-bottom: 1px solid $brand-primary; text-decoration: none; + background-color: $header-bg; &.slim { border-bottom: 1px solid $inverse-color; @@ -29,7 +30,7 @@ .nav-item { margin: 0 $baseline 0 0; font-weight: $font-weight-normal; - font-family: $font-family-sans-serif; + font-family: $font-family-base; text-transform: uppercase; list-style: none; @@ -47,7 +48,7 @@ display: none; } - @media (max-width: map-get($grid-breakpoints,lg)) { + @media (max-width: map-get($grid-breakpoints,md)) { &.nav-item-open-collapsed, &.nav-item-open-collapsed-only { display: initial; margin: $baseline/4 $baseline/2; @@ -73,7 +74,7 @@ } .navbar-right .nav-item { - @media (min-width: map-get($grid-breakpoints,lg)) { + @media (min-width: map-get($grid-breakpoints,md)) { .nav-link { text-transform: none; color: $brand-inverse; diff --git a/lms/static/sass/bootstrap/_variables.scss b/lms/static/sass/bootstrap/_variables.scss index a6c93c5990..043f6343d9 100644 --- a/lms/static/sass/bootstrap/_variables.scss +++ b/lms/static/sass/bootstrap/_variables.scss @@ -48,6 +48,9 @@ $black-t3: rgba($black, 0.75) !default; $light-grey-transparent: rgba(200,200,200, 0) !default; $light-grey-solid: rgba(200,200,200, 1) !default; +$header-bg: $white !default; +$footer-bg: $white !default; + // ---------------------------- // #TYPOGRAPHY // ---------------------------- diff --git a/lms/static/sass/bootstrap/lms-main-bootstrap.scss b/lms/static/sass/bootstrap/lms-main.scss similarity index 85% rename from lms/static/sass/bootstrap/lms-main-bootstrap.scss rename to lms/static/sass/bootstrap/lms-main.scss index 1b5298c5d6..8b2059f028 100644 --- a/lms/static/sass/bootstrap/lms-main-bootstrap.scss +++ b/lms/static/sass/bootstrap/lms-main.scss @@ -3,7 +3,7 @@ // ----------------------------- // Bootstrap theme -@import 'edx-bootstrap/sass/open-edx/theme'; +@import 'bootstrap/theme'; @import 'bootstrap/scss/bootstrap'; // Variables @@ -13,4 +13,3 @@ @import 'footer'; @import 'navigation'; @import 'layouts'; - diff --git a/lms/static/sass/partials/README.rst b/lms/static/sass/partials/README.rst new file mode 100644 index 0000000000..914165caef --- /dev/null +++ b/lms/static/sass/partials/README.rst @@ -0,0 +1,4 @@ +Any partials in this directory can be overridden by a theme by matching +the directory structure as in lms/static/sass/partials. + +As an example, look at the red-theme. \ No newline at end of file diff --git a/lms/static/sass/partials/bootstrap/_theme.scss b/lms/static/sass/partials/bootstrap/_theme.scss new file mode 100644 index 0000000000..98a8e97205 --- /dev/null +++ b/lms/static/sass/partials/bootstrap/_theme.scss @@ -0,0 +1,3 @@ +// Default bootstrap theming + +@import 'edx-bootstrap/sass/open-edx/theme'; diff --git a/lms/static/sass/shared-v2/_header.scss b/lms/static/sass/shared-v2/_header.scss index 6885484cc3..bf76962874 100644 --- a/lms/static/sass/shared-v2/_header.scss +++ b/lms/static/sass/shared-v2/_header.scss @@ -5,7 +5,7 @@ box-sizing: border-box; position: relative; width: 100%; - border-bottom: 1px solid $gray-l1; + border-bottom: 1px solid $header-border-color; box-shadow: 0 1px 5px 0 $shadow-l1; background: $header-bg; diff --git a/lms/static/sass/shared-v2/_variables.scss b/lms/static/sass/shared-v2/_variables.scss index 34a2cd7b9a..5ea9424aae 100644 --- a/lms/static/sass/shared-v2/_variables.scss +++ b/lms/static/sass/shared-v2/_variables.scss @@ -42,6 +42,8 @@ $black-t3: rgba($black, 0.75) !default; $light-grey-transparent: rgba(200,200,200, 0) !default; $light-grey-solid: rgba(200,200,200, 1) !default; +$header-border-color: $gray-l1 !default; + // ---------------------------- // #TYPOGRAPHY // ---------------------------- diff --git a/lms/templates/navigation/navigation.html b/lms/templates/navigation/navigation.html index 6afa7b455e..d3389465f5 100644 --- a/lms/templates/navigation/navigation.html +++ b/lms/templates/navigation/navigation.html @@ -51,7 +51,7 @@ site_status_msg = get_site_status_msg(course_id) % if uses_bootstrap: