|
|
|
@ -198,6 +198,10 @@ function confirmDelete() {
|
|
|
|
|
return confirm(aStr.delitem); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function confirmBlock() { |
|
|
|
|
return confirm(aStr.blockAuthor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Hide and removes an item element from the DOM after the deletion url is |
|
|
|
|
* successful, restore it else. |
|
|
|
@ -207,9 +211,34 @@ function confirmDelete() {
|
|
|
|
|
* @returns {undefined} |
|
|
|
|
*/ |
|
|
|
|
function dropItem(url, elementId) { |
|
|
|
|
var confirm = confirmDelete(); |
|
|
|
|
if (confirmDelete()) { |
|
|
|
|
$("body").css("cursor", "wait"); |
|
|
|
|
|
|
|
|
|
var $el = $(document.getElementById(elementId)); |
|
|
|
|
|
|
|
|
|
$el.fadeTo('fast', 0.33, function () { |
|
|
|
|
$.get(url).then(function() { |
|
|
|
|
$el.remove(); |
|
|
|
|
}).fail(function() { |
|
|
|
|
// @todo Show related error message
|
|
|
|
|
$el.show(); |
|
|
|
|
}).always(function() { |
|
|
|
|
$("body").css('cursor', 'auto'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (confirm) { |
|
|
|
|
/** |
|
|
|
|
* Blocks an author and hide and removes an item element from the DOM after the block is |
|
|
|
|
* successful, restore it else. |
|
|
|
|
* |
|
|
|
|
* @param {string} url The item removal URL |
|
|
|
|
* @param {string} elementId The DOM id of the item element |
|
|
|
|
* @returns {undefined} |
|
|
|
|
*/ |
|
|
|
|
function blockAuthor(url, elementId) { |
|
|
|
|
if (confirmBlock()) { |
|
|
|
|
$("body").css("cursor", "wait"); |
|
|
|
|
|
|
|
|
|
var $el = $(document.getElementById(elementId)); |
|
|
|
|