Commit d8bf0ef5 by Omar Al-Ithawi Committed by Frances Botsford

Elegant rtl/ltr css switch, LMS RTL fixes, language aware @cache_if_anonymous

parent ce3cb278
......@@ -71,13 +71,19 @@ lms/static/css/
lms/static/sass/*.css
lms/static/sass/*.css.map
lms/static/sass/application.scss
lms/static/sass/application-rtl.scss
lms/static/sass/application-extend1.scss
lms/static/sass/application-extend1-rtl.scss
lms/static/sass/application-extend2.scss
lms/static/sass/application-extend2-rtl.scss
lms/static/sass/course.scss
lms/static/sass/course-rtl.scss
cms/static/css/
cms/static/sass/*.css
cms/static/sass/*.css.map
### Logging artifacts
log/
logs
......
// studio - xmodule architecture
// ====================
@import 'vendor/bi-app/bi-app-ltr'; // set the layout for right to left languages
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
......
<%!
from staticfiles.storage import staticfiles_storage
from pipeline_mako import compressed_css, compressed_js
from django.utils.translation import get_language_bidi
%>
<%def name='url(file, raw=False)'><%
......@@ -11,6 +12,13 @@ except:
%>${url}${"?raw" if raw else ""}</%def>
<%def name='css(group, raw=False)'>
<%
rtl_group = '{}-rtl'.format(group)
if get_language_bidi() and rtl_group in settings.PIPELINE_CSS:
group = rtl_group
%>
% if settings.FEATURES['USE_DJANGO_PIPELINE']:
${compressed_css(group, raw=raw)}
% else:
......
......@@ -12,6 +12,8 @@ from django.core import cache
# If we can't find a 'general' CACHE defined in settings.py, we simply fall back
# to returning the default cache. This will happen with dev machines.
from django.utils.translation import get_language
try:
cache = cache.get_cache('general')
except Exception:
......@@ -45,7 +47,7 @@ def cache_if_anonymous(view_func):
# same view accessed through different domain names may
# return different things, so include the domain name in the key.
domain = str(request.META.get('HTTP_HOST')) + '.'
cache_key = domain + "cache_if_anonymous." + request.path
cache_key = domain + "cache_if_anonymous." + get_language() + '.' + request.path
response = cache.get(cache_key)
if not response:
response = view_func(request, *args, **kwargs)
......
/*
* This file is dynamically generated and ignored by Git.
* DO NOT MAKE CHANGES HERE. Instead, go edit its template:
* /edx/app/edxapp/edx-platform/lms/static/sass/application-extend1-rtl.scss.mako
*/
// lms - css application architecture (platform)
// ====================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
// BASE *default edX offerings*
// ====================
// base - utilities
@import 'base/reset';
@import 'base/config';
@import 'base/variables';
@import 'base/mixins';
@import 'base/base';
// base - assets
@import 'base/font_face';
@import 'base/extends';
@import 'base/animations';
// base - starter
@import 'base/base';
// base - elements
@import 'elements/typography';
@import 'elements/controls';
// shared - platform
@import 'multicourse/home';
@import 'multicourse/dashboard';
@import 'multicourse/account';
@import 'multicourse/courses';
@import 'multicourse/course_about';
@import 'multicourse/jobs';
@import 'multicourse/media-kit';
@import 'multicourse/about_pages';
@import 'multicourse/press_release';
@import 'multicourse/error-pages';
@import 'multicourse/help';
@import 'multicourse/edge';
@import 'developer'; // used for any developer-created scss that needs further polish/refactoring
@import 'shame'; // used for any bad-form/orphaned scss
/*
* This file is dynamically generated and ignored by Git.
* DO NOT MAKE CHANGES HERE. Instead, go edit its template:
* /edx/app/edxapp/edx-platform/lms/static/sass/application-extend2-rtl.scss.mako
*/
// lms - css application architecture (platform)
// ====================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
// BASE *default edX offerings*
// ====================
// base - utilities
@import 'base/reset';
@import 'base/config';
@import 'base/variables';
@import 'base/mixins';
@import 'base/base';
// base - assets
@import 'base/font_face';
@import 'base/extends';
@import 'base/animations';
// base - starter
@import 'base/base';
// base - elements
@import 'elements/typography';
@import 'elements/controls';
@import 'elements/system-feedback';
// base - specific views
@import 'views/verification';
@import 'views/shoppingcart';
// applications
@import "discussion/utilities/variables";
@import "discussion/mixins";
@import 'discussion/discussion'; // Process old file after definitions but before everything else
@import "discussion/elements/actions";
@import "discussion/elements/editor";
@import "discussion/elements/labels";
@import "discussion/elements/navigation";
@import "discussion/views/thread";
@import "discussion/views/create-edit-post";
@import "discussion/views/response";
@import 'discussion/utilities/developer';
@import 'discussion/utilities/shame';
@import 'news';
// temp - shame and developer
@import 'developer'; // used for any developer-created scss that needs further polish/refactoring
@import 'shame'; // used for any bad-form/orphaned scss
/*
* This file is dynamically generated and ignored by Git.
* DO NOT MAKE CHANGES HERE. Instead, go edit its template:
* /edx/app/edxapp/edx-platform/lms/static/sass/application-rtl.scss.mako
*/
// lms - css application architecture
// ====================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
// BASE *default edX offerings*
// ====================
// base - utilities
@import 'base/reset';
@import 'base/config';
@import 'base/variables';
@import 'base/mixins';
@import 'base/base';
// base - assets
@import 'base/font_face';
@import 'base/extends';
@import 'base/animations';
// base - starter
@import 'base/base';
// base - elements
@import 'elements/typography';
@import 'elements/controls';
// shared - course
@import 'shared/forms';
@import 'shared/footer';
@import 'shared/header';
@import 'shared/course_object';
@import 'shared/course_filter';
@import 'shared/modal';
@import 'shared/activation_messages';
@import 'shared/unsubscribe';
@import 'developer'; // used for any developer-created scss that needs further polish/refactoring
@import 'shame'; // used for any bad-form/orphaned scss
/*
* This file is dynamically generated and ignored by Git.
* DO NOT MAKE CHANGES HERE. Instead, go edit its template:
* /edx/app/edxapp/edx-platform/lms/static/sass/course-rtl.scss.mako
*/
@import 'bourbon/bourbon';
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
@import 'base/reset';
@import 'base/font_face';
@import 'base/variables';
@import 'base/mixins';
@import 'base/base';
@import 'base/extends';
@import 'base/animations';
@import 'shared/tooltips';
// base - elements
@import 'elements/typography';
@import 'elements/controls';
// Course base / layout styles
@import 'course/layout/courseware_header';
@import 'course/layout/footer';
@import 'course/base/mixins';
@import 'course/base/base';
@import 'course/base/extends';
@import 'xmodule/modules/css/module-styles.scss';
// courseware
@import 'course/courseware/courseware';
@import 'course/courseware/sidebar';
@import 'course/courseware/amplifier';
@import 'course/layout/calculator';
@import 'course/layout/timer';
@import 'course/layout/chat';
// course-specific courseware (all styles in these files should be gated by a
// course-specific class). This should be replaced with a better way of
// providing course-specific styling.
@import "course/courseware/courses/_cs188.scss";
// wiki
@import "course/wiki/basic-html";
@import "course/wiki/sidebar";
@import "course/wiki/create";
@import "course/wiki/wiki";
@import "course/wiki/table";
// pages
@import "course/info";
@import "course/syllabus"; // TODO arjun replace w/ custom tabs, see courseware/courses.py
@import "course/textbook";
@import "course/profile";
@import "course/gradebook";
@import "course/tabs";
@import "course/staff_grading";
@import "course/rubric";
@import "course/open_ended_grading";
// instructor
@import "course/instructor/instructor";
@import "course/instructor/instructor_2";
@import "course/instructor/email";
@import "xmodule/descriptors/css/module-styles.scss";
// discussion
@import "course/discussion/form-wmd-toolbar";
......@@ -16,7 +16,7 @@ nav.course-material {
@include border-top-radius(4px);
@include clearfix;
padding: 28px 0 10px 0;
margin-left: 10px;
@include margin-left(10px);
li {
@include float(left);
......
......@@ -3,11 +3,11 @@
body.discussion {
.course-tabs .right {
float: right;
@include float(right);
.new-post-btn {
@include blue-button;
margin-right: 4px;
@include margin-right(4px);
}
.new-post-icon {
......@@ -377,7 +377,7 @@ body.discussion {
display: inline-block;
text-align: center;
vertical-align: middle;
@include margin-right($baseline/2);
@include margin-left($baseline/2);
}
.icon {
......
......@@ -889,7 +889,7 @@
}
a.unenroll {
float: right;
@include float(right);
display: block;
font-style: italic;
color: $lighter-base-font-color;
......@@ -904,7 +904,7 @@
a.email-settings {
@extend a.unenroll;
margin-right: 10px;
@include margin-right(10px);
}
}
......
......@@ -109,7 +109,7 @@ header.global {
> .primary {
display: block;
float: left;
@include float(left);
margin: 0px;
position: relative;
......@@ -120,14 +120,14 @@ header.global {
&:last-child {
> a {
border-radius: 0 4px 4px 0;
border-left: none;
@include border-radius(0, 4px, 4px, 0);
@include border-left(none);
padding: 5px 8px 7px 8px;
&.shopping-cart {
border-radius: 4px;
border: 1px solid $border-color-2;
margin-right: 10px;
@include margin-right(10px);
padding-bottom: 6px;
}
}
......@@ -135,7 +135,7 @@ header.global {
}
a.user-link {
padding: 6px 12px 8px 35px;
@include padding(6px, 12px, 8px, 35px);
position: relative;
text-transform: none;
font-size: 14px;
......@@ -145,9 +145,14 @@ header.global {
.avatar {
@include background-image(url('../images/small-header-home-icon.png'));
background-repeat: no-repeat;
@include rtl {
background-position: top right;
}
height: 26px;
display: inline-block;
left: 8px;
@include left(8px);
opacity: 0.5;
overflow: hidden;
position: absolute;
......@@ -171,7 +176,7 @@ header.global {
display: none;
padding: 5px 10px;
position: absolute;
right: 0px;
@include right(0px);
top: 34px;
width: 170px;
z-index: 3;
......@@ -394,7 +399,7 @@ header.global-new {
}
.primary {
margin-right: 5px;
@include margin-right(5px);
> a {
@include background-image($button-bg-image);
......@@ -415,7 +420,7 @@ header.global-new {
vertical-align: middle;
&:last-child {
margin-right: 0px;
@include margin-right(0px);
}
&:hover, &:focus, &:active {
......@@ -430,7 +435,7 @@ header.global-new {
> .primary {
display: block;
float: left;
@include float(left);
margin: 0px;
position: relative;
......@@ -456,7 +461,7 @@ header.global-new {
}
a.user-link {
padding: 6px 12px 8px 35px;
@include padding(6px, 12px, 8px, 35px);
position: relative;
text-transform: none;
font-size: 14px;
......@@ -468,7 +473,7 @@ header.global-new {
background-repeat: no-repeat;
height: 26px;
display: inline-block;
left: 8px;
@include left(8px);
opacity: 0.5;
overflow: hidden;
position: absolute;
......@@ -492,7 +497,7 @@ header.global-new {
display: none;
padding: 5px 10px;
position: absolute;
right: 0px;
@include right(0px);
top: 34px;
width: 170px;
z-index: 3;
......@@ -515,7 +520,7 @@ header.global-new {
height: 0px;
position: absolute;
@include transform(rotate(-45deg));
right: 12px;
@include right(12px);
top: -6px;
width: 0px;
}
......
......@@ -59,17 +59,10 @@
<link rel="icon" type="image/x-icon" href="${static.url(microsite.get_value('favicon_path', settings.FAVICON_PATH))}" />
% if get_language_bidi():
<%static:css group='style-vendor'/>
<%static:css group='style-app-rtl'/>
<%static:css group='style-app-extend1-rtl'/>
<%static:css group='style-app-extend2-rtl'/>
% else:
<%static:css group='style-vendor'/>
<%static:css group='style-app'/>
<%static:css group='style-app-extend1'/>
<%static:css group='style-app-extend2'/>
% endif
<%static:css group='style-vendor'/>
<%static:css group='style-app'/>
<%static:css group='style-app-extend1'/>
<%static:css group='style-app-extend2'/>
% if disable_courseware_js:
<%static:js group='base_vendor'/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment