Merge branch 'feature/cale/cms-master' into fix/cale/edge-bugs

Conflicts:
	cms/static/js/base.js
This commit is contained in:
Chris Dodge
2012-10-13 21:44:15 -04:00
10 changed files with 1254 additions and 10 deletions

View File

@@ -74,6 +74,9 @@ $(document).ready(function() {
handle: 'header .drag-handle',
update: onSectionReordered
});
$('.new-course-button').bind('click', addNewCourse);
});
function showImportSubmit(e) {
@@ -81,6 +84,7 @@ function showImportSubmit(e) {
$('.file-name-block').show();
$('.import .choose-file-button').hide();
$('.submit-button').show();
$('.progress').show();
}
function syncReleaseDate(e) {
@@ -449,6 +453,7 @@ function addNewSection(e) {
$newSection.find('.new-section-name-cancel').bind('click', cancelNewSection);
}
function saveNewSection(e) {
e.preventDefault();
@@ -473,6 +478,48 @@ function cancelNewSection(e) {
$(this).parents('section.new-section').remove();
}
function addNewCourse(e) {
e.preventDefault();
var $newCourse = $($('#new-course-template').html());
$('.new-course-button').after($newCourse);
$newCourse.find('.new-course-org').focus().select();
$newCourse.find('.new-course-save').bind('click', saveNewCourse);
$newCourse.find('.new-course-cancel').bind('click', cancelNewCourse);
}
function saveNewCourse(e) {
e.preventDefault();
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();
if (org == '' || number == '' || display_name == ''){
alert('You must specify all fields in order to create a new course.')
}
$.post('/create_new_course',
{ 'template' : template,
'org' : org,
'number' : number,
'display_name': display_name,
},
function(data) {
if (data.id != undefined)
location.reload();
else if (data.ErrMsg != undefined)
alert(data.ErrMsg);
});
}
function cancelNewCourse(e) {
e.preventDefault();
$(this).parents('section.new-course').remove();
}
function addNewSubsection(e) {
e.preventDefault();
var $section = $(this).closest('.courseware-section');