NIHVIVO-707 Tweaks to addAuthors and manageWebpages Javascript
This commit is contained in:
parent
ed9e8b9be8
commit
ede7b51779
2 changed files with 32 additions and 16 deletions
|
@ -528,10 +528,17 @@ var addAuthorForm = {
|
|||
|
||||
removeAuthorship: function(link) {
|
||||
// RY Upgrade this to a modal window
|
||||
var message = 'Are you sure you want to remove this author?';
|
||||
var removeLast = false,
|
||||
message = 'Are you sure you want to remove this author?';
|
||||
|
||||
if (!confirm(message)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($(link)[0] === $('.remove:last')[0]) {
|
||||
removeLast = true;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: $(link).attr('href'),
|
||||
type: 'POST',
|
||||
|
@ -566,15 +573,16 @@ var addAuthorForm = {
|
|||
|
||||
// Actions that depend on the author having been removed from the DOM:
|
||||
numAuthors = $('.authorship').length; // retrieve the length after removing authorship from the DOM
|
||||
if (numAuthors > 0) {
|
||||
// Reorder to remove any gaps
|
||||
|
||||
// If removed item not last, reorder to remove any gaps
|
||||
if (numAuthors > 0 && ! removeLast) {
|
||||
addAuthorForm.reorderAuthors();
|
||||
|
||||
// If fewer than two authors remaining, disable drag-drop
|
||||
if (numAuthors < 2) {
|
||||
addAuthorForm.disableAuthorDD();
|
||||
}
|
||||
}
|
||||
|
||||
// If fewer than two authors remaining, disable drag-drop
|
||||
if (numAuthors < 2) {
|
||||
addAuthorForm.disableAuthorDD();
|
||||
}
|
||||
});
|
||||
|
||||
// $(this).hide();
|
||||
|
|
|
@ -151,10 +151,17 @@ var manageWebpages = {
|
|||
|
||||
removeWebpage: function(link) {
|
||||
// RY Upgrade this to a modal window
|
||||
var message = 'Are you sure you want to remove this web page?';
|
||||
var removeLast = false,
|
||||
message = 'Are you sure you want to remove this web page?';
|
||||
|
||||
if (!confirm(message)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($(link)[0] === $('.remove:last')[0]) {
|
||||
removeLast = true;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: $(link).attr('href'),
|
||||
type: 'POST',
|
||||
|
@ -178,15 +185,16 @@ var manageWebpages = {
|
|||
|
||||
// Actions that depend on the webpage having been removed from the DOM:
|
||||
numWebpages = $('.webpage').length; // retrieve the new length after removing webpage from the DOM
|
||||
if (numWebpages > 0) {
|
||||
// Reorder to remove any gaps
|
||||
|
||||
// If removed item not last, reorder to remove any gaps
|
||||
if (numWebpages > 0 && ! removeLast) {
|
||||
manageWebpages.reorder();
|
||||
|
||||
// If fewer than two webpages remaining, disable drag-drop
|
||||
if (numWebpages < 2) {
|
||||
manageWebpages.disableDD();
|
||||
}
|
||||
}
|
||||
|
||||
// If fewer than two webpages remaining, disable drag-drop
|
||||
if (numWebpages < 2) {
|
||||
manageWebpages.disableDD();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue