1 window
.onload = function() {
6 courseArray: courseArray
,
16 redirect: function(code
) {
17 document
.location
.href
= "/" + initials
+ "/" + code
;
19 addCourse: function() {
22 // modal, fill code and description
23 let error
= Validator
.checkCode(this.newCourse
.code
);
27 $('#newCourse').modal('close');
36 this.newCourse
["code"] = "";
37 this.newCourse
["description"] = "";
38 this.courseArray
.push(res
);
46 deleteCourse: function(course
) {
49 if (confirm("Delete course '" + course
.code
+ "' ?"))
50 $.ajax("/remove/course",
53 data: { cid: course
._id
},
57 this.courseArray
.splice( this.courseArray
.findIndex( item
=> {
58 return item
._id
== course
._id
;