Commit aa4361b3 by Chris Dodge

Merge branch 'feature/cale/cms-master' of github.com:MITx/mitx into fix/cdodge/signup-tweeks

parents 4d439bbe 16720f51
......@@ -109,7 +109,7 @@ def index(request):
courses = modulestore().get_items(['i4x', None, None, 'course', None])
# filter out courses that we don't have access to
courses = filter(lambda course: has_access(request.user, course.location) and course.location.course != 'templates', courses)
courses = filter(lambda course: has_access(request.user, course.location) and course.location.course != 'templates' and course.location.org!='' and course.location.course!='' and course.location.name!='', courses)
return render_to_response('index.html', {
'new_course_template' : Location('i4x', 'edx', 'templates', 'course', 'Empty'),
......@@ -273,6 +273,26 @@ def edit_unit(request, location):
containing_section_locs = modulestore().get_parent_locations(containing_subsection.location)
containing_section = modulestore().get_item(containing_section_locs[0])
# cdodge hack. We're having trouble previewing drafts via jump_to redirect
# so let's generate the link url here
# need to figure out where this item is in the list of children as the preview will need this
index =1
for child in containing_subsection.get_children():
if child.location == item.location:
break
index = index + 1
preview_lms_link = '//{preview}{lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'.format(
preview='preview.',
lms_base=settings.LMS_BASE,
org=course.location.org,
course=course.location.course,
course_name=course.location.name,
section=containing_section.location.name,
subsection=containing_subsection.location.name,
index=index)
unit_state = compute_unit_state(item)
try:
......
......@@ -57,12 +57,12 @@ class CMS.Views.ModuleEdit extends Backbone.View
data = @module.save()
data.metadata = @metadata()
@model.save(data).done( =>
alert("Your changes have been saved.")
showToastMessage("Your changes have been saved.", null, 3)
@module = null
@render()
@$el.removeClass('editing')
).fail( ->
alert("There was an error saving your changes. Please try again.")
showToastMessage("There was an error saving your changes. Please try again.", null, 3)
)
clickCancelButton: (event) ->
......
......@@ -491,11 +491,13 @@ function addNewCourse(e) {
function saveNewCourse(e) {
e.preventDefault();
var $newCourse = $(this).closest('.new-course');
template = $(this).data('template');
org = $(this).prevAll('.new-course-org').val();
number = $(this).prevAll('.new-course-number').val();
display_name = $(this).prevAll('.new-course-name').val();
org = $newCourse.find('.new-course-org').val();
number = $newCourse.find('.new-course-number').val();
display_name = $newCourse.find('.new-course-name').val();
if (org == '' || number == '' || display_name == ''){
alert('You must specify all fields in order to create a new course.');
......
......@@ -41,4 +41,57 @@
display: block;
padding: 20px;
text-align: center;
}
.new-course {
padding: 15px 25px;
margin-top: 20px;
border-radius: 3px;
border: 1px solid $darkGrey;
background: #fff;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
@include clearfix;
.row {
margin-bottom: 15px;
@include clearfix;
}
.column {
float: left;
width: 48%;
}
.column:first-child {
margin-right: 4%;
}
.course-info {
width: 600px;
}
label {
display: block;
font-size: 13px;
font-weight: 700;
}
.new-course-org,
.new-course-number,
.new-course-name {
width: 100%;
}
.new-course-name {
font-size: 19px;
font-weight: 300;
}
.new-course-save {
@include blue-button;
}
.new-course-cancel {
@include white-button;
}
}
\ No newline at end of file
......@@ -67,4 +67,28 @@
white-space: normal;
}
}
.progress-bar {
display: none;
width: 350px;
height: 30px;
margin: 30px auto 10px;
border: 1px solid $blue;
&.loaded {
border-color: #66b93d;
.progress-fill {
background: #66b93d;
}
}
}
.progress-fill {
width: 0%;
height: 30px;
background: $blue;
color: #fff;
line-height: 48px;
}
}
\ No newline at end of file
......@@ -23,9 +23,9 @@
<p class="file-name-block"><span class="file-name"></span><a href="#" class="choose-file-button-inline">change</a></p>
<input type="file" name="course-data" class="file-input">
<input type="submit" value="Replace my course with the one above" class="submit-button">
<div class="progress" style="position:relative; margin-top:5px; width:250px; height:15px; border: 1px solid #ddd; padding: 1px; border-radius: 3px; display:none;">
<div class="bar" style="background-color: #B4F5B4; width:0%; height:10px; border-radius: 3px;"></div>
<div class="percent" style="margin-top:5px;">0%</div>
<div class="progress-bar">
<div class="progress-fill"></div>
<div class="percent">0%</div>
</div>
</form>
</article>
......@@ -37,29 +37,35 @@
<script>
(function() {
var bar = $('.bar');
var bar = $('.progress-bar');
var fill = $('.progress-fill');
var percent = $('.percent');
var status = $('#status');
var submitBtn = $('.submit-button');
$('form').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
bar.show();
fill.width(percentVal);
percent.html(percentVal);
submitBtn.hide();
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
fill.width(percentVal);
percent.html(percentVal);
},
complete: function(xhr) {
if (xhr.status == 200) {
alert('Your import has been successful.');
alert('Your import was successful.');
window.location = '${successful_import_redirect_url}';
}
else
alert('Your import has failed.\n\n' + xhr.responseText);
submitBtn.show();
bar.hide();
}
});
})();
......
......@@ -4,16 +4,29 @@
<%block name="header_extras">
<script type="text/template" id="new-course-template">
<section class="courseware-section new-course">
<header>
<div class="item-details">
<h3 class="course-info">
<input type="text" placeholder="Organization" class="new-course-org" />
<input type="text" placeholder="Course Number" class="new-course-number" />
<input type="text" placeholder="Course Name" class="new-course-name" />
<a href="#" class="new-course-save" data-template="${new_course_template}">Save</a><a href="#" class="new-course-cancel">Cancel</a></h3>
</div>
</header>
<section class="new-course">
<div class="item-details">
<form class="course-info">
<div class="row">
<label>Course Name</label>
<input type="text" class="new-course-name" />
</div>
<div class="row">
<div class="column">
<label>Organization</label>
<input type="text" class="new-course-org" />
</div>
<div class="column">
<label>Course Number</label>
<input type="text" class="new-course-number" />
</div>
</div>
<div class="row">
<a href="#" class="new-course-save" data-template="${new_course_template}">Save</a>
<a href="#" class="new-course-cancel">Cancel</a>
</div>
</form>
</div>
</section>
</script>
</%block>
......
......@@ -10,7 +10,7 @@
<a href="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" class="class-name">${context_course.display_name}</a>
<ul class="class-nav">
<li><a href="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='courseware-tab'>Courseware</a></li>
<li><a href="${reverse('static_pages', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}" id='pages-tab' class="wip-box">Pages</a></li>
<li><a href="${reverse('static_pages', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}" id='pages-tab' style="display:none">Pages</a></li>
<li><a href="${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='assets-tab'>Assets</a></li>
<li><a href="${reverse('manage_users', kwargs=dict(location=ctx_loc))}" id='users-tab'>Users</a></li>
<li><a href="${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='import-tab'>Import</a></li>
......
......@@ -9,7 +9,7 @@ data: |
<section class='update-description'>
<section class='primary'>
<p> Words of encouragement! This is a short note that most students will read. </p>
<p class='author'>&mdash; Anant Agarwal (6.002x Principle Instructor)</p>
<p class='author'>Anant Agarwal (6.002x Principle Instructor)</p>
</section>
<p><h3>Primary versus Secondary Updates:</h3> Unfortunately, the internet throws a lot of text at students, and they
do not read everything that they are given. However, many students <em>do</em> read all that they are
......
......@@ -7,7 +7,6 @@ data: |
<problem>
<startouttext />
Your goal for this lab is to design a circuit that implements a
<!-- \overline doesn't seem to render correctly -->
3-input logic gate that implements \(Z = \lnot{(C(A+B))}\) where the
\(\lnot\) symbol stands for logical negation. This function is
enumerated in the following truth table:
......
......@@ -8,7 +8,7 @@ data: |
<p>
A multiple choice response problem presents radio buttons for student
input. <!-->One or more of the choice may be correct.--> Correctness of
input. Correctness of
input is evaluated based on expected answers specified within each
"choice" stanza.
</p>
......
......@@ -325,6 +325,12 @@ def jump_to(request, course_id, location):
except NoPathToItem:
raise Http404("This location is not in any class: {0}".format(location))
# cdodge: the CAS is generating a link to the LMS for 'subsections' (aka sequentials)
# and there is no associated 'Position' for this. The above Path_to_location is returning None for Position
# however, this ends up producing a 404 on the redirect
if position is None:
position = 0
# Rely on index to do all error handling and access control.
return redirect('courseware_position',
course_id=course_id,
......
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