Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import json
import random
import string # pylint: disable=W0402

from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django_future.csrf import ensure_csrf_cookie
from django.core.context_processors import csrf
from django.conf import settings
from django.views.decorators.http import require_http_methods
from django.core.exceptions import PermissionDenied
Expand Down Expand Up @@ -56,8 +56,11 @@
from opaque_keys.edx.keys import CourseKey
from course_creators.views import get_course_creator_status, add_user_with_status_unrequested
from contentstore import utils
from dark_lang.models import DarkLangConfig
from student.roles import CourseInstructorRole, CourseStaffRole, CourseCreatorRole, GlobalStaff
from student import auth
from user_api.models import UserPreference
from lang_pref import LANGUAGE_KEY

from microsite_configuration import microsite

Expand Down Expand Up @@ -245,12 +248,35 @@ def format_course_for_view(course):
course.location.name
)

language_options = DarkLangConfig.current().released_languages_list

# add in the default language if it's not in the list of released languages
if settings.LANGUAGE_CODE not in language_options:
language_options.append(settings.LANGUAGE_CODE)
# Re-alphabetize language options
language_options.sort()

# try to get the prefered language for the user
cur_lang_code = UserPreference.get_preference(request.user, LANGUAGE_KEY)
if cur_lang_code:
# if the user has a preference, get the name from the code
current_language = settings.LANGUAGE_DICT[cur_lang_code]
else:
# if the user doesn't have a preference, use the site language
current_language = settings.LANGUAGE_DICT[settings.LANGUAGE_CODE]

csrf_token = csrf(request)['csrf_token']

return render_to_response('index.html', {
'courses': [format_course_for_view(c) for c in courses if not isinstance(c, ErrorDescriptor)],
'user': request.user,
'request_course_creator_url': reverse('contentstore.views.request_course_creator'),
'course_creator_status': _get_course_creator_status(request.user),
'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False)
'allow_unicode_course_id': settings.FEATURES.get('ALLOW_UNICODE_COURSE_ID', False),
'language_options': language_options,
'current_language': current_language,
'current_language_code': cur_lang_code,
'csrf_token': csrf_token,
})


Expand Down
7 changes: 6 additions & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,15 @@
# Allows us to dark-launch particular languages
'dark_lang.middleware.DarkLangMiddleware',

'embargo.middleware.EmbargoMiddleware',
# Allows us to set user preferences
# should be after DarkLangMiddleware
'lang_pref.middleware.LanguagePreferenceMiddleware',

# Detects user-requested locale from 'accept-language' header in http request
'django.middleware.locale.LocaleMiddleware',

'embargo.middleware.EmbargoMiddleware',

'django.middleware.transaction.TransactionMiddleware',
# needs to run after locale middleware (or anything that modifies the request context)
'edxmako.middleware.MakoMiddleware',
Expand Down Expand Up @@ -288,6 +292,7 @@
LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html

LANGUAGES = lms.envs.common.LANGUAGES
LANGUAGE_DICT = lms.envs.common.LANGUAGE_DICT
USE_I18N = True
USE_L10N = True

Expand Down
30 changes: 30 additions & 0 deletions cms/static/sass/elements/_controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,33 @@
}
}
}

// ====================

// UI: toggle editing state
.ui-toggle-edit {

// STATE: not editing (implied)
.ui-toggle-edit-display {
@include transition(opacity $tmg-f1 ease-in-out 0s);
@extend %ui-shown;
}

.ui-toggle-edit-form {
@include transition(opacity $tmg-f1 ease-in-out 0s);
@extend %ui-hidden;
}

// STATE: is editing
&.is-editing {

.ui-toggle-edit-form {
@extend %ui-shown;
}

.ui-toggle-edit-display {
@extend %ui-hidden;
}
}
}

9 changes: 5 additions & 4 deletions cms/static/sass/elements/_system-help.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@
padding-bottom: 0;
}

.title-super {
@extend %hd-delta;
}

h3, .title {
@extend %t-title7;
margin: 0 0 ($baseline/4) 0;
color: $gray-d2;
font-weight: 600;
@extend %hd-epsilon;
}

p, .copy {
Expand Down
99 changes: 99 additions & 0 deletions cms/static/sass/elements/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@

// Scale - (6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 36, 48, 60, 72)

// weight
%t-weight0 {
font-weight: 300;
}

%t-weight1 {
font-weight: 400;
}

%t-weight2 {
font-weight: 500;
}

%t-weight3 {
font-weight: 600;
}

%t-weight4 {
font-weight: 700;
}

// headings/titles
%t-title {
font-family: $f-sans-serif;
Expand Down Expand Up @@ -176,3 +197,81 @@
@include font-size(10);
@include line-height(10);
}

// ====================

// canned typography - headers
%hd-alpha {

}

%hd-bravo {

}

%hd-charlie {

}

%hd-delta {
@extend %t-weight3;
@extend %t-title7;
margin: 0 0 ($baseline/2) 0;
border-bottom: 1px solid $gray-l4;
padding: 0 0 ($baseline/4) 0;
color: $gray-l3;
}

%hd-epsilon {
@extend %t-weight3;
@extend %t-title7;
margin: 0 0 ($baseline/4) 0;
color: $gray-d2;
}

%hd-foxtrot {

}

%hd-golf {

}

// ====================

// canned typography - copy
%copy-alpha {

}

%copy-bravo {

}

%copy-charlie {

}

%copy-delta {

}

// ====================

// canned typography - actions
%action-alpha {

}

%action-bravo {
@extend %t-action2;
}

%action-charlie {
@extend %t-weight3;
@extend %t-action3;
}

%action-delta {

}
Loading