VRFS-3359 : Teacher profile REST functions.

This commit is contained in:
Steven Miers 2015-08-08 15:00:44 -05:00
parent 968722bf80
commit d76899be54
1 changed files with 56 additions and 1 deletions

View File

@ -476,6 +476,58 @@
});
}
function getTeacher(options) {
// var url = '/api/teacher/detail'
// if(options && _.size(options) > 0) {
// console.log("WTF");
// url += "?" + $.param(options)
// }
// console.log("THE URL", url)
return $.ajax({
type: "GET",
dataType: "json",
url: '/api/teachers/detail?'+ $.param(options),
contentType: 'application/json',
processData: false
});
}
function deleteTeacher(teacherId) {
var url = "/api/teachers/" + teacherId;
return $.ajax({
type: "DELETE",
dataType: "json",
url: url,
contentType: 'application/json',
processData:false
});
}
function updateTeacher(teacher) {
console.log("Updating teacher", teacher)
var id = teacher && teacher["id"]
var url
if (id != null && typeof(id) != 'undefined') {
url = '/api/teachers/' + teacher.id
} else {
url = '/api/teachers'
}
var deferred = $.ajax({
type: "POST",
dataType: "json",
url: url,
contentType: 'application/json',
processData: false,
data: JSON.stringify(teacher)
})
return deferred
}
function getSession(id) {
var url = "/api/sessions/" + id;
return $.ajax({
@ -989,7 +1041,7 @@
type: 'GET',
dataType: "json",
url: "/api/feeds?" + $.param(options),
processData:false
processData:false
})
}
@ -1945,6 +1997,9 @@
this.getBandPhotoFilepickerPolicy = getBandPhotoFilepickerPolicy;
this.getBand = getBand;
this.validateBand = validateBand;
this.getTeacher = getTeacher;
this.updateTeacher = updateTeacher;
this.deleteTeacher = deleteTeacher;
this.updateFavorite = updateFavorite;
this.createBandInvitation = createBandInvitation;
this.updateBandInvitation = updateBandInvitation;