Commit 7ef8b6ac by Calen Pennington

Merge remote-tracking branch 'origin/release/1.0'

parents 30452d32 0b3da68f
......@@ -30,6 +30,7 @@ class AuthTestCase(TestCase):
self.email = 'a@b.com'
self.pw = 'xyz'
self.username = 'testuser'
self.client = Client()
def check_page_get(self, url, expected):
resp = self.client.get(url)
......@@ -63,7 +64,8 @@ class AuthTestCase(TestCase):
'language' : 'Franglish',
'name' : 'Fred Weasley',
'terms_of_service' : 'true',
'honor_code' : 'true'})
'honor_code' : 'true',
})
return resp
def create_account(self, username, email, pw):
......@@ -121,7 +123,7 @@ class AuthTestCase(TestCase):
resp = self._login(self.email, self.pw)
data = parse_json(resp)
self.assertFalse(data['success'])
self.activate_user(self.email)
# Now login should work
......@@ -144,6 +146,9 @@ class AuthTestCase(TestCase):
# need an activated user
self.test_create_account()
# Create a new session
self.client = Client()
# Not logged in. Should redirect to login.
print 'Not logged in'
for page in auth_pages:
......
from util.json_request import expect_json
import json
from django.http import HttpResponse
from django.http import HttpResponse, Http404
from django.contrib.auth.decorators import login_required
from django.core.context_processors import csrf
from django_future.csrf import ensure_csrf_cookie
from django.core.urlresolvers import reverse
from fs.osfs import OSFS
from xmodule.modulestore import Location
from github_sync import export_to_github
......@@ -14,6 +13,7 @@ from github_sync import export_to_github
from mitxmako.shortcuts import render_to_response
from xmodule.modulestore.django import modulestore
# ==== Public views ==================================================
@ensure_csrf_cookie
......@@ -22,7 +22,8 @@ def signup(request):
Display the signup form.
"""
csrf_token = csrf(request)['csrf_token']
return render_to_response('signup.html', {'csrf': csrf_token })
return render_to_response('signup.html', {'csrf': csrf_token})
@ensure_csrf_cookie
def login_page(request):
......@@ -30,8 +31,9 @@ def login_page(request):
Display the login form.
"""
csrf_token = csrf(request)['csrf_token']
return render_to_response('login.html', {'csrf': csrf_token })
return render_to_response('login.html', {'csrf': csrf_token})
# ==== Views for any logged-in user ==================================
@login_required
......@@ -47,6 +49,7 @@ def index(request):
for course in courses]
})
# ==== Views with per-item permissions================================
def has_access(user, location):
......@@ -54,18 +57,20 @@ def has_access(user, location):
# TODO (vshnayder): actually check perms
return user.is_active and user.is_authenticated
@login_required
@ensure_csrf_cookie
def course_index(request, org, course, name):
location = ['i4x', org, course, 'course', name]
if not has_access(request.user, location):
raise Http404 # TODO (vshnayder): better error
# TODO (cpennington): These need to be read in from the active user
course = modulestore().get_item(location)
weeks = course.get_children()
return render_to_response('course_index.html', {'weeks': weeks})
@login_required
def edit_item(request):
# TODO (vshnayder): change name from id to location in coffee+html as well.
......@@ -73,7 +78,7 @@ def edit_item(request):
print item_location, request.GET
if not has_access(request.user, item_location):
raise Http404 # TODO (vshnayder): better error
item = modulestore().get_item(item_location)
return render_to_response('unit.html', {
'contents': item.get_html(),
......@@ -98,6 +103,7 @@ def user_author_string(user):
last=l,
email=user.email)
@login_required
@expect_json
def save_item(request):
......
Someone, hopefully you, signed up for an account for edX's on-line
offering of "${ course_title}" using this email address. If it was
you, and you'd like to activate and use your account, copy and paste
this address into your web browser's address bar:
Thank you for signing up for edX! To activate your account,
please copy and paste this address into your web browser's
address bar:
% if is_secure:
https://${ site }/activate/${ key }
% else:
http://edx4edx.mitx.mit.edu/activate/${ key }
http://${ site }/activate/${ key }
% endif
If you didn't request this, you don't need to do anything; you won't
......
Your account for edX's on-line ${course_title} course
Your account for edX
<%! from django.core.urlresolvers import reverse %>
<%inherit file="../base.html" />
<%namespace name='static' file='../static_content.html'/>
<section class="container activation">
<section class="message">
%if not already_active:
<h1 class="valid">Activation Complete!</h1>
%else:
<h1>Account already active!</h1>
%endif
<hr class="horizontal-divider">
<p>
%if not already_active:
Thanks for activating your account.
%else:
This account has already been activated.
%endif
%if user_logged_in:
Visit your <a href="${reverse('dashboard')}">dashboard</a> to see your courses.
%else:
You can now <a href="#login-modal" rel="leanModal">login</a>.
%endif
</p>
</section>
</section>
......@@ -307,14 +307,14 @@ def create_account(request, post_override=None):
up = UserProfile(user=u)
up.name = post_vars['name']
up.level_of_education = post_vars['level_of_education']
up.gender = post_vars['gender']
up.mailing_address = post_vars['mailing_address']
up.goals = post_vars['goals']
up.level_of_education = post_vars.get('level_of_education')
up.gender = post_vars.get('gender')
up.mailing_address = post_vars.get('mailing_address')
up.goals = post_vars.get('goals')
try:
up.year_of_birth = int(post_vars['year_of_birth'])
except ValueError:
except (ValueError, KeyError):
up.year_of_birth = None # If they give us garbage, just ignore it instead
# of asking them to put an integer.
try:
......
......@@ -46,7 +46,7 @@ def course_static_url(course):
return settings.STATIC_URL + "/" + course.metadata['data_dir'] + "/"
def course_image_url(course):
return course_static_url(course) + "images/course_image.png"
return course_static_url(course) + "images/course_image.jpg"
def get_course_about_section(course, section_key):
"""
......
......@@ -82,8 +82,9 @@ a:link, a:visited {
.container {
@include clearfix;
margin: 0 auto 0;
padding: 0px 10px;
padding: 0px 30px;
max-width: grid-width(12);
min-width: 760px;
}
span.edx {
......
.container.about {
padding: 20px 10px 120px;
padding: 20px 30px 120px;
> nav {
margin-bottom: 80px;
......@@ -102,7 +102,6 @@
img {
background: rgb(245,245,245);
display: block;
//height: 200px;
width: 100%;
}
}
......@@ -257,14 +256,14 @@
.contact {
@include clearfix;
margin: 0 auto;
width: flex-grid(10);
.map {
background: rgb(245,245,245);
.photo {
@include box-sizing(border-box);
background: rgb(255,255,255);
border: 1px solid rgb(210,210,210);
padding: 1px;
float: left;
margin-right: flex-gutter();
overflow: hidden;
width: flex-grid(6);
width: flex-grid(3);
img {
max-width: 100%;
......@@ -275,7 +274,7 @@
@include box-sizing(border-box);
float: left;
padding-left: 40px;
width: flex-grid(6);
width: flex-grid(9);
ul {
list-style: none;
......
......@@ -30,11 +30,11 @@
border: 1px solid rgb(100,100,100);
@include box-shadow(0 4px 25px 0 rgba(0,0,0, 0.5));
@include box-sizing(border-box);
height: 120px;
min-height: 120px;
margin-left: grid-width(2) + $gw-gutter;
width: flex-grid(6);
float: left;
position: relative;
text-align: center;
@include transition(all, 0.2s, linear);
vertical-align: top;
......@@ -46,7 +46,6 @@
> hgroup {
@include box-sizing(border-box);
height: 120px;
@include inline-block;
left: 0px;
opacity: 1;
......@@ -86,7 +85,7 @@
padding: 4px;
position: relative;
vertical-align: top;
width: 210px;
width: flex-grid(2) + flex-gutter();
z-index: 2;
&:hover {
......@@ -97,6 +96,8 @@
height: 100%;
overflow: hidden;
position: relative;
background: url('../images/courses/video-thumb.jpg') center no-repeat;
@include background-size(cover);
.play-intro {
@include background-image(linear-gradient(-90deg, rgba(0,0,0, 0.65), rgba(0,0,0, 0.75)));
......
.container.jobs {
padding: 60px 0 120px;
padding: 60px 30px 120px;
q {
display: block;
......@@ -34,8 +34,7 @@
img {
background: rgb(245,245,245);
display: block;
height: 200px;
width: 100%;
max-width: 100%;
}
}
......@@ -54,7 +53,7 @@
p {
margin-left: 0;
font-style: italic;
line-height: 1.4;
line-height: 1.6;
font-size: 1.1em;
color: #666;
}
......@@ -63,6 +62,7 @@
margin-top: 12px;
display: block;
color: #a0a0a0;
font-weight: 300;
}
}
}
......
......@@ -195,9 +195,8 @@
.citizenship, .gender, .date-of-birth {
margin-bottom: 20px;
.input-wrapper {
}
float: left;
width: flex-grid(4);
label {
display: block;
......@@ -205,36 +204,15 @@
select {
width: 100%;
@include box-sizing(border-box);
display: block;
}
}
.citizenship, .gender {
float: left;
width: flex-grid(4);
}
.citizenship {
margin-right: flex-gutter();
}
.date-of-birth {
float: left;
width: flex-grid(12);
select {
@include box-sizing(border-box);
display: block;
float: left;
margin-right: flex-gutter();
max-width: flex-grid(4);
width: flex-grid(4);
&:last-child {
margin: 0px;
}
}
}
.submit {
padding-top: 10px;
......
......@@ -11,12 +11,12 @@
</nav>
<section class="contact">
<div class="map">
<div class="photo">
<img src="${static.url('images/contact-page.jpg')}">
</div>
<div class="contacts">
<h2>Class Feedback</h2>
<p>We are always seeking feedback to improve our courses. If you are an enrolled student and have any questions, feedback, suggestions, or any other issues specific to a particular class, please post on the discussion forums of that class.</p>
<p>We are always seeking feedback to improve our courses. If you are an enrolled student and have any questions, feedback, suggestions, or any other issues specific to a particular class, please post on the discussion forums of that&nbsp;class.</p>
<h2>General Inquiries and Feedback</h2>
<p>"If you have a general question about edX please email <a href="mailto:info@edx.org">info@edx.org</a>. To see if your question has already been answered, visit our <a href="${reverse('faq_edx')}">FAQ page</a>. You can also join the discussion on our <a href="http://www.facebook.com/EdxOnline">facebook page</a>. Though we may not have a chance to respond to every email, we take all feedback into consideration.</p>
......
......@@ -36,7 +36,6 @@
<a href="#video-modal" class="media" rel="leanModal">
<div class="hero">
<img src="${static.url('images/courses/video-thumb.jpg')}" />
<div class="play-intro"></div>
</div>
</a>
......
......@@ -54,7 +54,7 @@
</div>
</section>
<section class="gender">
<section class="date-of-birth">
<label>Year of birth</label>
<div class="input-wrapper">
<select name="year_of_birth">
......
......@@ -14,12 +14,12 @@
</nav>
<section class="contact">
<div class="map">
<div class="photo">
<img src="${static.url('images/contact-page.jpg')}">
</div>
<div class="contacts">
<h2>Class Feedback</h2>
<p>We are always seeking feedback to improve our courses. If you are an enrolled student and have any questions, feedback, suggestions, or any other issues specific to a particular class, please post on the discussion forums of that class.</p>
<p>We are always seeking feedback to improve our courses. If you are an enrolled student and have any questions, feedback, suggestions, or any other issues specific to a particular class, please post on the discussion forums of that&nbsp;class.</p>
<h2>General Inquiries and Feedback</h2>
<p>"If you have a general question about edX please email <a href="mailto:info@edx.org">info@edx.org</a>. To see if your question has already been answered, visit our <a href="${reverse('faq_edx')}">FAQ page</a>. You can also join the discussion on our <a href="http://www.facebook.com/EdxOnline">facebook page</a>. Though we may not have a chance to respond to every email, we take all feedback into consideration.</p>
......
......@@ -7,55 +7,27 @@
<%block name="title"><title>Honor Code</title></%block>
<section class="static-container honor-code">
<h1> Honor Code </h1>
<h1>Honor Code</h1>
<hr class="horizontal-divider">
<div class="inner-wrapper">
<p> By enrolling in a course on <i>edX</i>, you are joining a
special worldwide community of learners. The aspiration
of <i>edX</i> is to provide anyone in the world who has the
motivation and ability to engage edX coursework the opportunity
to attain the best edX-based educational experience that
Internet technology enables. You are part of the community who
will help <i>edX</i> achieve this goal.</p>
<p> <i>edX</i> depends upon your motivation to learn the material
and to do so with honesty. In order to participate
in <i>edX</i>, you must agree to the Honor Code below and any
additional terms specific to a class. This Honor Code, and any
additional terms, will be posted on each class website.</p>
<h2><i>edX</i> Honor Code Pledge</h2>
<p> By enrolling in an <i>edX</i> course, I agree that I will:</p>
<h2>Collaboration Policy</h2>
<p>By enrolling in a course on edX, you are joining a special worldwide community of learners. The aspiration of edX is to provide anyone in the world who has the motivation and ability to engage coursework from the Massachusetts Institute of Technology, Harvard University and the University of California, Berkeley the opportunity to attain the best MIT, Harvard and UC Berkeley-based educational experience that internet technology enables. You are part of the community who will help edX achieve this goal.</p>
<p>EdX depends upon your motivation to learn the material and to do so with honesty. In order to participate in edX, you must agree to the Honor Code below and any additional terms specific to a class. This Honor Code, and any additional terms, will be posted on each class website.</p>
<h2>edX Honor Code Pledge</h2>
<p>By enrolling in an edX course, I agree that I will:</p>
<ul>
<li>
<p>Complete all mid-terms and final exams with my own work and only my own work. I will not submit the work of any other person.</p>
</li>
<li>
<p>Maintain only one user account and not let anyone else use my username and/or password.</p>
</li>
<li>
<p>Not engage in any activity that would dishonestly improve my results, or improve or hurt the results of others.</p>
</li>
<li>
<p>Not post answers to problems that are being used to assess student performance.</p>
</li>
<li>Complete all mid-terms and final exams with my own work and only my own work. I will not submit the work of any other person.</li>
<li>Maintain only one user account and not let anyone else use my username and/or password.</li>
<li>Not engage in any activity that would dishonestly improve my results, or improve or hurt the results of others.</li>
<li>Not post answers to problems that are being used to assess student performance.</li>
</ul>
<p> Unless otherwise indicated by the instructor of an <i>edX</i> course, learners on <i>edX</i> are encouraged to:</p>
<p>Unless otherwise indicated by the instructor of an edX course, learners on edX are encouraged to:</p>
<ul>
<li>
<p>Collaborate with others on the lecture videos, exercises, homework and labs.</p>
</li>
<li>
<p>Discuss with others general concepts and materials in each course.</p>
</li>
<li>
<p>Present ideas and written work to fellow <i>edX</i> learners or others for comment or criticism.</p>
</li>
<li>Collaborate with others on the lecture videos, exercises, homework and labs.</li>
<li>Discuss with others general concepts and materials in each course.</li>
<li>Present ideas and written work to fellow edX learners or others for comment or criticism.</li>
</ul>
</div>
</section>
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