Changeset - e76fcb188bbb
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2011-03-29 21:06:39
ohnobinki@ohnopublishing.net
Prevent the user from deleting the one empty course.
1 file changed with 12 insertions and 3 deletions:
0 comments (0 inline, 0 general)
scripts/scheduleInput.js
Show inline comments
 
@@ -472,27 +472,36 @@ function prettyTime(time_str)
 
    return hour_str + ':' + time_str.substr(2) + ' ' + m + 'm';
 
}
 

	
 
//--------------------------------------------------
 
// Items bound to pageload/events
 
//--------------------------------------------------
 
jQuery(document).ready(function() {
 

	
 
	//--------------------------------------------------
 
	// Deletes the selected class from input
 
	//--------------------------------------------------
 
	jQuery('.deleteClass').live('click', function() {
 
		if(confirm('Delete class and all sections of this class?')) {
 
		    course_remove(jQuery(this).parent().parent().data('course_i'));
 
		}
 
	    /* The user is not allowed to interactively delete the one empty course */
 
	    var course_i = jQuery(this).parent().parent().data('course_i');
 
	    if (slate_permutate_course_free == course_i)
 
		return false;
 
	    if(confirm('Delete class and all sections of this class?')) {
 
		/* The one empty course may have became this course in that time */
 
		if (slate_permutate_course_free == course_i)
 
		    return false;
 
		course_remove(course_i);
 
		return false;
 
	    }
 
	    return false;
 
	});
 

	
 
	//--------------------------------------------------
 
	// Deletes the selected section from the input
 
	//--------------------------------------------------
 
	jQuery('.deleteSection').live('click', function() {
 
	  // Decreases the total number of classes
 
		var course_i = jQuery(this).parent().parent().data('course_i');
 
		sectionsOfClass[course_i]--;
 

	
 
	  // Find the ID cell of the row we're in
 
	  var row = jQuery(this).parent().parent().find(".sectionIdentifier");
0 comments (0 inline, 0 general)