NIHVIVO-646 Removed undo link feature from add authors form due to time limitations. Added confirm for the remove links; can upgrade to jquery ui dialog later.

This commit is contained in:
rjy7 2010-06-30 17:34:55 +00:00
parent 8e986d2d87
commit cbe6a58aa6
2 changed files with 26 additions and 17 deletions

View file

@ -317,7 +317,7 @@ SPARQL queries for existing values. --%>
<li class="author" id="${authorUri}"> <li class="author" id="${authorUri}">
<span class="authorName"><a href="${authorHref}" class="existingAuthor">${author.name}</a></span> <span class="authorName"><a href="${authorHref}" class="existingAuthor">${author.name}</a></span>
<a href="${deleteAuthorshipHref}" id="${authorshipUri}" class="remove">Remove</a> <a href="${deleteAuthorshipHref}" id="${authorshipUri}" class="remove">Remove</a>
<a href="${undoHref}" class="undo">Undo</a> <%-- <a href="${undoHref}" class="undo">Undo</a> --%>
</li> </li>
<% <%

View file

@ -22,7 +22,7 @@ var addAuthorForm = {
this.showFormButtonWrapper = $('#showAddForm'); this.showFormButtonWrapper = $('#showAddForm');
this.showFormButton = $('#showAddFormButton'); this.showFormButton = $('#showAddFormButton');
this.removeAuthorshipLinks = $('a.remove'); this.removeAuthorshipLinks = $('a.remove');
this.undoLinks = $('a.undo'); //this.undoLinks = $('a.undo');
this.submit = this.form.find(':submit'); this.submit = this.form.find(':submit');
this.cancel = this.form.find('.cancel'); this.cancel = this.form.find('.cancel');
this.labelField = $('#label'); this.labelField = $('#label');
@ -46,7 +46,7 @@ var addAuthorForm = {
// NB The non-JavaScript version of this form is currently not functional. // NB The non-JavaScript version of this form is currently not functional.
this.removeAuthorshipLinks.show(); this.removeAuthorshipLinks.show();
this.undoLinks.hide(); //this.undoLinks.hide();
this.bindEventListeners(); this.bindEventListeners();
@ -97,6 +97,11 @@ var addAuthorForm = {
}); });
this.removeAuthorshipLinks.click(function() { this.removeAuthorshipLinks.click(function() {
// RY Upgrade this to a modal window
var message = "Are you sure you want to remove this author?";
if (!confirm(message)) {
return false;
}
$.ajax({ $.ajax({
url: $(this).attr('href'), url: $(this).attr('href'),
type: 'POST', type: 'POST',
@ -106,15 +111,19 @@ var addAuthorForm = {
dataType: 'json', dataType: 'json',
context: $(this), // context for callback context: $(this), // context for callback
complete: function(request, status) { complete: function(request, status) {
var author = $(this).siblings('span.authorName'); var authorListing = $(this).parent();
var authorLink = author.children('a.existingAuthor'); // var author = $(this).siblings('span.authorName');
var authorName = authorLink.html(); // var authorLink = author.children('a.existingAuthor');
// var authorName = authorLink.html();
if (status === 'success') { if (status === 'success') {
$(this).hide(); authorListing.fadeOut(400, function() {
$(this).siblings('.undo').show(); $(this).remove();
author.html(authorName + ' has been removed'); });
author.css('width', 'auto'); // $(this).hide();
author.effect("highlight", {}, 3000); // $(this).siblings('.undo').show();
// author.html(authorName + ' has been removed');
// author.css('width', 'auto');
// author.effect("highlight", {}, 3000);
} else { } else {
alert('Error processing request'); alert('Error processing request');
} }
@ -123,12 +132,12 @@ var addAuthorForm = {
return false; return false;
}); });
this.undoLinks.click(function() { // this.undoLinks.click(function() {
$.ajax({ // $.ajax({
url: $(this).attr('href') // url: $(this).attr('href')
}); // });
return false; // return false;
}); // });
}, },