NIHVIVO-646 Broke removeAuthorship out into a separate function

This commit is contained in:
rjy7 2010-07-04 16:08:21 +00:00
parent 96d9b0508e
commit 3772389dd7

View file

@ -96,19 +96,34 @@ var addAuthorForm = {
});
this.removeAuthorshipLinks.click(function() {
addAuthorForm.removeAuthorship(this);
return false;
});
// this.undoLinks.click(function() {
// $.ajax({
// url: $(this).attr('href')
// });
// return false;
// });
},
removeAuthorship: function(link) {
// RY Upgrade this to a modal window
var message = "Are you sure you want to remove this author?";
if (!confirm(message)) {
return false;
}
$.ajax({
url: $(this).attr('href'),
url: $(link).attr('href'),
type: 'POST',
data: {
deletion: $(this).parents('.authorship').attr('id')
deletion: $(link).parents('.authorship').attr('id')
},
dataType: 'json',
context: $(this), // context for callback
context: link, // context for callback
complete: function(request, status) {
var authorship = $(this).parents('.authorship'),
nextAuthorships = authorship.nextAll(),
@ -159,16 +174,6 @@ var addAuthorForm = {
}
}
});
return false;
});
// this.undoLinks.click(function() {
// $.ajax({
// url: $(this).attr('href')
// });
// return false;
// });
},
// Disable DD and associated cues if only one author remains
@ -452,11 +457,11 @@ var addAuthorForm = {
minLength: 2,
source: function(request, response) {
if (request.term in addAuthorForm.acCache) {
console.log("found term in cache");
// console.log("found term in cache");
response(addAuthorForm.acCache[request.term]);
return;
}
console.log("not getting term from cache");
// console.log("not getting term from cache");
// If the url query params are too long, we could do a post
// here instead of a get. Add the exclude uris to the data