Commit f14dd9d3 by Waheed Ahmed Committed by Alasdair

Disabled student view if course is not yet released for students.

LMS-6617

Fixed wiki merge url regex.
TNL-413

ECOM-345 changed any lists that could display with only 1 item to divs

ECOM-345 Added aria tags for header

ECOM-364 Accessibility update for footer

added my name to the authors file

Addressing feedback from code review - removing unnecessary element references in selectors

Updated header aria-label to be main
parent 4aa2dc52
...@@ -173,3 +173,4 @@ Jason Zhu <fmyzjs@gmail.com> ...@@ -173,3 +173,4 @@ Jason Zhu <fmyzjs@gmail.com>
Marceau Cnudde <marceau.cnudde@gmail.com> Marceau Cnudde <marceau.cnudde@gmail.com>
Braden MacDonald <mail@bradenm.com> Braden MacDonald <mail@bradenm.com>
Jonathan Piacenti <kelketek@gmail.com> Jonathan Piacenti <kelketek@gmail.com>
Alasdair Swan <aswan@edx.org>
...@@ -6,6 +6,7 @@ import logging ...@@ -6,6 +6,7 @@ import logging
import urllib import urllib
import json import json
from datetime import datetime
from collections import defaultdict from collections import defaultdict
from django.utils import translation from django.utils import translation
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
...@@ -16,6 +17,7 @@ from django.core.exceptions import PermissionDenied ...@@ -16,6 +17,7 @@ from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils.timezone import UTC
from django.views.decorators.http import require_GET from django.views.decorators.http import require_GET
from django.http import Http404, HttpResponse from django.http import Http404, HttpResponse
from django.shortcuts import redirect from django.shortcuts import redirect
...@@ -27,7 +29,7 @@ from functools import wraps ...@@ -27,7 +29,7 @@ from functools import wraps
from markupsafe import escape from markupsafe import escape
from courseware import grades from courseware import grades
from courseware.access import has_access from courseware.access import has_access, _adjust_start_date_for_beta_testers
from courseware.courses import get_courses, get_course, get_studio_url, get_course_with_access, sort_by_announcement from courseware.courses import get_courses, get_course, get_studio_url, get_course_with_access, sort_by_announcement
from courseware.masquerade import setup_masquerade from courseware.masquerade import setup_masquerade
from courseware.model_data import FieldDataCache from courseware.model_data import FieldDataCache
...@@ -337,6 +339,13 @@ def index(request, course_id, chapter=None, section=None, ...@@ -337,6 +339,13 @@ def index(request, course_id, chapter=None, section=None,
'reverifications': fetch_reverify_banner_info(request, course_key), 'reverifications': fetch_reverify_banner_info(request, course_key),
} }
now = datetime.now(UTC())
effective_start = _adjust_start_date_for_beta_testers(user, course, course_key)
if staff_access and now < effective_start:
# Disable student view button if user is staff and
# course is not yet visible to students.
context['disable_student_access'] = True
has_content = course.has_children_at_depth(CONTENT_DEPTH) has_content = course.has_children_at_depth(CONTENT_DEPTH)
if not has_content: if not has_content:
# Show empty courseware for a course with no units # Show empty courseware for a course with no units
...@@ -590,6 +599,13 @@ def course_info(request, course_id): ...@@ -590,6 +599,13 @@ def course_info(request, course_id):
'url_to_enroll': url_to_enroll, 'url_to_enroll': url_to_enroll,
} }
now = datetime.now(UTC())
effective_start = _adjust_start_date_for_beta_testers(request.user, course, course_key)
if staff_access and now < effective_start:
# Disable student view button if user is staff and
# course is not yet visible to students.
context['disable_student_access'] = True
return render_to_response('courseware/info.html', context) return render_to_response('courseware/info.html', context)
......
...@@ -469,6 +469,7 @@ LMS_MIGRATION_ALLOWED_IPS = [] ...@@ -469,6 +469,7 @@ LMS_MIGRATION_ALLOWED_IPS = []
# too many inadvertent side effects :-( # too many inadvertent side effects :-(
COURSE_KEY_PATTERN = r'(?P<course_key_string>[^/+]+(/|\+)[^/+]+(/|\+)[^/]+)' COURSE_KEY_PATTERN = r'(?P<course_key_string>[^/+]+(/|\+)[^/+]+(/|\+)[^/]+)'
COURSE_ID_PATTERN = COURSE_KEY_PATTERN.replace('course_key_string', 'course_id') COURSE_ID_PATTERN = COURSE_KEY_PATTERN.replace('course_key_string', 'course_id')
COURSE_KEY_REGEX = COURSE_KEY_PATTERN.replace('P<course_key_string>', ':')
USAGE_KEY_PATTERN = r'(?P<usage_key_string>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))' USAGE_KEY_PATTERN = r'(?P<usage_key_string>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
ASSET_KEY_PATTERN = r'(?P<asset_key_string>(?:/?c4x(:/)?/[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))' ASSET_KEY_PATTERN = r'(?P<asset_key_string>(?:/?c4x(:/)?/[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
......
...@@ -26,12 +26,11 @@ header.global { ...@@ -26,12 +26,11 @@ header.global {
} }
} }
ol { .left {
&.left {
float: left; float: left;
} }
&.guest { .guest {
float: right; float: right;
} }
...@@ -72,7 +71,7 @@ header.global { ...@@ -72,7 +71,7 @@ header.global {
} }
} }
li.primary { .primary {
margin-right: 5px; margin-right: 5px;
> a { > a {
...@@ -104,14 +103,15 @@ header.global { ...@@ -104,14 +103,15 @@ header.global {
} }
} }
&.user { .user {
float: right; float: right;
margin-top: 4px; margin-top: 4px;
> li.primary { > .primary {
display: block; display: block;
float: left; float: left;
margin: 0px; margin: 0px;
position: relative;
> a { > a {
margin: 0px; margin: 0px;
...@@ -163,7 +163,7 @@ header.global { ...@@ -163,7 +163,7 @@ header.global {
} }
} }
ul.dropdown-menu { .dropdown-menu {
background: $border-color-4; background: $border-color-4;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 24px 0 rgba(0,0,0, 0.3); box-shadow: 0 2px 24px 0 rgba(0,0,0, 0.3);
...@@ -232,13 +232,14 @@ header.global { ...@@ -232,13 +232,14 @@ header.global {
} }
} }
} }
}
.nav-global { .nav-global {
margin-top: ($baseline/2); margin-top: ($baseline/2);
list-style: none; list-style: none;
float: left;
li { li,
div {
display: inline-block; display: inline-block;
margin: 0 $baseline+1 0 0; margin: 0 $baseline+1 0 0;
font-size: em(14); font-size: em(14);
...@@ -282,7 +283,7 @@ header.global { ...@@ -282,7 +283,7 @@ header.global {
margin-top: ($baseline/4); margin-top: ($baseline/4);
list-style: none; list-style: none;
li { div {
display: inline-block; display: inline-block;
.cta { .cta {
...@@ -350,12 +351,11 @@ header.global-new { ...@@ -350,12 +351,11 @@ header.global-new {
} }
} }
ol { .left {
&.left {
float: left; float: left;
} }
&.guest { .guest {
float: right; float: right;
} }
...@@ -394,7 +394,7 @@ header.global-new { ...@@ -394,7 +394,7 @@ header.global-new {
} }
} }
li.primary { .primary {
margin-right: 5px; margin-right: 5px;
> a { > a {
...@@ -425,14 +425,15 @@ header.global-new { ...@@ -425,14 +425,15 @@ header.global-new {
} }
} }
&.user { .user {
float: right; float: right;
margin-top: 4px; margin-top: 4px;
> li.primary { > .primary {
display: block; display: block;
float: left; float: left;
margin: 0px; margin: 0px;
position: relative;
> a { > a {
margin: 0px; margin: 0px;
...@@ -484,7 +485,7 @@ header.global-new { ...@@ -484,7 +485,7 @@ header.global-new {
} }
} }
ul.dropdown-menu { .dropdown-menu {
background: $border-color-4; background: $border-color-4;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 24px 0 rgba(0,0,0, 0.3); box-shadow: 0 2px 24px 0 rgba(0,0,0, 0.3);
...@@ -553,13 +554,14 @@ header.global-new { ...@@ -553,13 +554,14 @@ header.global-new {
} }
} }
} }
}
.nav-global { .nav-global {
margin-top: ($baseline/2); margin-top: ($baseline/2);
list-style: none; list-style: none;
float: left;
li { li,
div {
display: inline-block; display: inline-block;
margin: 0 $baseline+1 0 0; margin: 0 $baseline+1 0 0;
text-transform: uppercase; text-transform: uppercase;
...@@ -587,12 +589,22 @@ header.global-new { ...@@ -587,12 +589,22 @@ header.global-new {
} }
} }
.nav-courseware { .nav-courseware {
@extend .nav-global; @extend .nav-global;
float: right; float: right;
li { div {
display: inline-block;
margin: 0 21px 0 0;
text-transform: uppercase;
letter-spacing: 0!important;
position: relative;
vertical-align: middle;
&:last-child {
margin-right: 0;
}
a { a {
&.nav-courseware-button { &.nav-courseware-button {
padding: 5px 45px 5px 45px; padding: 5px 45px 5px 45px;
......
...@@ -62,6 +62,10 @@ def url_class(is_active): ...@@ -62,6 +62,10 @@ def url_class(is_active):
<script type="text/javascript"> <script type="text/javascript">
masq = (function(){ masq = (function(){
var el = $('#staffstatus'); var el = $('#staffstatus');
% if disable_student_access:
el.attr("disabled", true);
el.attr("title", "${_("Course is not yet visible to students.")}");
% endif
var setstat = function(status){ var setstat = function(status){
if (status=='student'){ if (status=='student'){
el.html('<font color="green">${_("Student view")}</font>'); el.html('<font color="green">${_("Student view")}</font>');
...@@ -72,6 +76,9 @@ masq = (function(){ ...@@ -72,6 +76,9 @@ masq = (function(){
setstat('${masquerade}'); setstat('${masquerade}');
el.click(function(){ el.click(function(){
if (el.attr("disabled")) {
return alert("${_("You cannot view the course as a student or beta tester before the course release date.")}");
}
$.ajax({ url: '/masquerade/toggle', $.ajax({ url: '/masquerade/toggle',
type: 'GET', type: 'GET',
success: function(result){ success: function(result){
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
## WARNING: These files are specific to edx.org and are not used in installations outside of that domain. Open edX users will want to use the file "footer.html" for any changes or overrides. ## WARNING: These files are specific to edx.org and are not used in installations outside of that domain. Open edX users will want to use the file "footer.html" for any changes or overrides.
<div class="wrapper wrapper-footer edx-footer edx-footer-new"> <div class="wrapper wrapper-footer edx-footer edx-footer-new">
<footer id="footer-global" class="footer-global" role="contentinfo"> <footer id="footer-global" class="footer-global" role="contentinfo" aria-label="Footer">
<div class="footer-about"> <div class="footer-about">
<h2 class="sr footer-about-title">${_("About edX")}</h2> <h2 class="sr footer-about-title">${_("About edX")}</h2>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</div> </div>
</div> </div>
<div class="footer-nav"> <nav class="footer-nav" role="navigation" aria-label="About Us">
<h2 class="footer-nav-title">${_("About & Company Info")}</h2> <h2 class="footer-nav-title">${_("About & Company Info")}</h2>
<div class="footer-nav-links"> <div class="footer-nav-links">
...@@ -58,30 +58,30 @@ ...@@ -58,30 +58,30 @@
<a href="${marketing_link('DONATE')}" class="has-emphasis"><span class="copy">${_("Donate to edX")}</span></a> <a href="${marketing_link('DONATE')}" class="has-emphasis"><span class="copy">${_("Donate to edX")}</span></a>
<a href="${marketing_link('JOBS')}" class="has-emphasis"><span class="copy">${_("Jobs at edX")}</span></a> <a href="${marketing_link('JOBS')}" class="has-emphasis"><span class="copy">${_("Jobs at edX")}</span></a>
</div> </div>
</div> </nav>
<div class="footer-follow"> <div class="footer-follow">
<h2 class="footer-follow-title">${_("Follow Us")}</h2> <h2 class="footer-follow-title">${_("Follow Us")}</h2>
<div class="footer-follow-links"> <div class="footer-follow-links">
<a href="${settings.PLATFORM_TWITTER_URL}" title="Twitter"> <a href="${settings.PLATFORM_TWITTER_URL}" title="Twitter">
<i class="icon icon-twitter"></i> <i class="icon icon-twitter element-invisible"></i>
<span class="copy">${_("Twitter")}</span> <span class="copy">${_("Twitter")}</span>
</a> </a>
<a href="${settings.PLATFORM_FACEBOOK_ACCOUNT}" title="Facebook"> <a href="${settings.PLATFORM_FACEBOOK_ACCOUNT}" title="Facebook">
<i class="icon icon-facebook-sign"></i> <i class="icon icon-facebook-sign element-invisible"></i>
<span class="copy">${_("Facebook")}</span> <span class="copy">${_("Facebook")}</span>
</a> </a>
<a href="${settings.PLATFORM_MEETUP_URL}" title="Meetup"> <a href="${settings.PLATFORM_MEETUP_URL}" title="Meetup">
<i class="icon icon-calendar"></i> <i class="icon icon-calendar element-invisible"></i>
<span class="copy">${_("Meetup")}</span> <span class="copy">${_("Meetup")}</span>
</a> </a>
<a href="${settings.PLATFORM_LINKEDIN_URL}" title="LinkedIn"> <a href="${settings.PLATFORM_LINKEDIN_URL}" title="LinkedIn">
<i class="icon icon-linkedin-sign"></i> <i class="icon icon-linkedin-sign element-invisible"></i>
<span class="copy">${_("LinkedIn")}</span> <span class="copy">${_("LinkedIn")}</span>
</a> </a>
<a href="${settings.PLATFORM_GOOGLE_PLUS_URL}" title="Google+"> <a href="${settings.PLATFORM_GOOGLE_PLUS_URL}" title="Google+">
<i class="icon icon-google-plus-sign"></i> <i class="icon icon-google-plus-sign element-invisible"></i>
<span class="copy">${_("Google+")}</span> <span class="copy">${_("Google+")}</span>
</a> </a>
</div> </div>
......
...@@ -36,12 +36,12 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -36,12 +36,12 @@ site_status_msg = get_site_status_msg(course_id)
% endif % endif
</%block> </%block>
<header class="${"global slim" if course else "global-new"}" aria-label="${_('Global Navigation')}"> <header class="${"global slim" if course else "global-new"}" aria-label="Main" role="banner">
<nav> <nav aria-label="Main">
<h1 class="logo"> <h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
<a href="${marketing_link('ROOT')}"> <a href="${marketing_link('ROOT')}" title="Home page" itemprop="url">
<%block name="navigation_logo"> <%block name="navigation_logo">
<img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}"/> <img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}" title="${platform_name()}" itemprop="url" />
</%block> </%block>
</a> </a>
</h1> </h1>
...@@ -51,15 +51,16 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -51,15 +51,16 @@ site_status_msg = get_site_status_msg(course_id)
% endif % endif
% if user.is_authenticated(): % if user.is_authenticated():
<ol class="left nav-global authenticated"> <div class="left nav-global authenticated">
<%block name="navigation_global_links_authenticated"> <%block name="navigation_global_links_authenticated">
% if settings.FEATURES.get('COURSES_ARE_BROWSABLE'): % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<li class="nav-global-01"> <div class="nav-global-01">
<a href="${marketing_link('COURSES')}">${_('Find Courses')}</a> <a href="${marketing_link('COURSES')}">${_('Find Courses')}</a>
</li> </div>
% endif % endif
</%block> </%block>
</ol> </div>
<ol class="user"> <ol class="user">
<li class="primary"> <li class="primary">
<a href="${reverse('dashboard')}" class="user-link"> <a href="${reverse('dashboard')}" class="user-link">
...@@ -79,6 +80,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -79,6 +80,7 @@ site_status_msg = get_site_status_msg(course_id)
</ul> </ul>
</li> </li>
</ol> </ol>
% if display_shopping_cart: # see shoppingcart.context_processor.user_has_cart_context_processor % if display_shopping_cart: # see shoppingcart.context_processor.user_has_cart_context_processor
<ol class="user"> <ol class="user">
<li class="primary"> <li class="primary">
...@@ -105,19 +107,19 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -105,19 +107,19 @@ site_status_msg = get_site_status_msg(course_id)
</%block> </%block>
</ol> </ol>
<ol class="right nav-courseware"> <div class="right nav-courseware">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<li class="nav-courseware-01"> <div class="nav-courseware-01">
<a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a> <a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a>
</li> </div>
% else: % else:
<li class="nav-courseware-01"> <div class="nav-courseware-01">
<a class="cta cta-register" href="/register">${_("Register")}</a> <a class="cta cta-register" href="/register">${_("Register")}</a>
</li> </div>
% endif % endif
% endif % endif
<li class="nav-courseware-02"> <div class="nav-courseware-02">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="cta cta-login nav-courseware-button" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a> <a class="cta cta-login nav-courseware-button" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a>
...@@ -125,8 +127,8 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -125,8 +127,8 @@ site_status_msg = get_site_status_msg(course_id)
<a class="cta cta-login nav-courseware-button" href="/login${login_query()}">${_("Log in")}</a> <a class="cta cta-login nav-courseware-button" href="/login${login_query()}">${_("Log in")}</a>
% endif % endif
% endif % endif
</li> </div>
</ol> </div>
% endif % endif
</nav> </nav>
</header> </header>
......
...@@ -188,7 +188,7 @@ if settings.WIKI_ENABLED: ...@@ -188,7 +188,7 @@ if settings.WIKI_ENABLED:
# never be returned by a reverse() so they come after the other url patterns # never be returned by a reverse() so they come after the other url patterns
url(r'^courses/{}/course_wiki/?$'.format(settings.COURSE_ID_PATTERN), url(r'^courses/{}/course_wiki/?$'.format(settings.COURSE_ID_PATTERN),
'course_wiki.views.course_wiki_redirect', name="course_wiki"), 'course_wiki.views.course_wiki_redirect', name="course_wiki"),
url(r'^courses/{}/wiki/'.format(settings.COURSE_ID_PATTERN), include(wiki_pattern())), url(r'^courses/{}/wiki/'.format(settings.COURSE_KEY_REGEX), include(wiki_pattern())),
) )
if settings.COURSEWARE_ENABLED: if settings.COURSEWARE_ENABLED:
......
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