Replace tabs with whitespace in moderation.js.

svn path=/plone.app.discussion/trunk/; revision=49036
This commit is contained in:
Timo Stollenwerk 2011-04-22 15:43:58 +00:00
parent c66e243a86
commit f551e30849

View File

@ -8,143 +8,143 @@
// This unnamed function allows us to use $ inside of a block of code // This unnamed function allows us to use $ inside of a block of code
// without permanently overwriting $. // without permanently overwriting $.
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries // http://docs.jquery.com/Using_jQuery_with_Other_Libraries
//#JSCOVERAGE_IF 0 //#JSCOVERAGE_IF 0
/************************************************************************** /**************************************************************************
* Window Load Function: Executes when complete page is fully loaded, * Window Load Function: Executes when complete page is fully loaded,
* including all frames, * including all frames,
**************************************************************************/ **************************************************************************/
$(window).load(function () { $(window).load(function () {
/********************************************************************** /**********************************************************************
* Delete a single comment. * Delete a single comment.
**********************************************************************/ **********************************************************************/
$("input[name='form.button.Delete']").click(function (e) { $("input[name='form.button.Delete']").click(function (e) {
e.preventDefault(); e.preventDefault();
var button = $(this); var button = $(this);
var row = $(this).parent().parent(); var row = $(this).parent().parent();
var form = $(row).parents("form"); var form = $(row).parents("form");
var path = $(row).find("[name='selected_obj_paths:list']").attr("value"); var path = $(row).find("[name='selected_obj_paths:list']").attr("value");
var target = path + "/@@moderate-delete-comment"; var target = path + "/@@moderate-delete-comment";
var comment_id = $(this).attr("id"); var comment_id = $(this).attr("id");
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: target, url: target,
success: function (msg) { success: function (msg) {
// fade out row // fade out row
$(row).fadeOut("normal", function () { $(row).fadeOut("normal", function () {
$(this).remove(); $(this).remove();
}); });
}, },
error: function (msg) { error: function (msg) {
alert("Error sending AJAX request:" + target); alert("Error sending AJAX request:" + target);
} }
}); });
}); });
/********************************************************************** /**********************************************************************
* Publish a single comment. * Publish a single comment.
**********************************************************************/ **********************************************************************/
$("input[name='form.button.Publish']").click(function (e) { $("input[name='form.button.Publish']").click(function (e) {
e.preventDefault(); e.preventDefault();
var button = $(this); var button = $(this);
var row = $(this).parent().parent(); var row = $(this).parent().parent();
var form = $(row).parents("form"); var form = $(row).parents("form");
var path = $(row).find("[name='selected_obj_paths:list']").attr("value"); var path = $(row).find("[name='selected_obj_paths:list']").attr("value");
var target = path + "/@@moderate-publish-comment"; var target = path + "/@@moderate-publish-comment";
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: target, url: target,
data: "workflow_action=publish", data: "workflow_action=publish",
success: function (msg) { success: function (msg) {
// fade out row // fade out row
$(row).fadeOut("normal", function () { $(row).fadeOut("normal", function () {
$(this).remove(); $(this).remove();
}); });
}, },
error: function (msg) { error: function (msg) {
alert("Error sending AJAX request:" + target); alert("Error sending AJAX request:" + target);
} }
}); });
}); });
/********************************************************************** /**********************************************************************
* Bulk actions for comments (delete, publish) * Bulk actions for comments (delete, publish)
**********************************************************************/ **********************************************************************/
$("input[name='form.button.BulkAction']").click(function (e) { $("input[name='form.button.BulkAction']").click(function (e) {
e.preventDefault(); e.preventDefault();
var form = $(this).parents("form"); var form = $(this).parents("form");
var target = $(form).attr('action'); var target = $(form).attr('action');
var params = $(form).serialize(); var params = $(form).serialize();
var valArray = $('input:checkbox:checked'); var valArray = $('input:checkbox:checked');
var selectField = $(form).find("[name='form.select.BulkAction']"); var selectField = $(form).find("[name='form.select.BulkAction']");
if (selectField.val() === '-1') { if (selectField.val() === '-1') {
// XXX: translate message // XXX: translate message
alert("You haven't selected a bulk action. Please select one."); alert("You haven't selected a bulk action. Please select one.");
} else if (valArray.length === 0) { } else if (valArray.length === 0) {
// XXX: translate message // XXX: translate message
alert("You haven't selected any comment for this bulk action." + alert("You haven't selected any comment for this bulk action." +
"Please select at least one comment."); "Please select at least one comment.");
} else { } else {
$.post(target, params, function (data) { $.post(target, params, function (data) {
valArray.each(function () { valArray.each(function () {
/* Remove all selected lines. */ /* Remove all selected lines. */
var row = $(this).parent().parent(); var row = $(this).parent().parent();
row.fadeOut("normal", function () { row.fadeOut("normal", function () {
row.remove(); row.remove();
}); });
}); });
}); });
// reset the bulkaction select // reset the bulkaction select
selectField.find("option[value='-1']").attr('selected', 'selected'); selectField.find("option[value='-1']").attr('selected', 'selected');
} }
}); });
/********************************************************************** /**********************************************************************
* Check or uncheck all checkboxes from the batch moderation page. * Check or uncheck all checkboxes from the batch moderation page.
**********************************************************************/ **********************************************************************/
$("input[name='check_all']").click(function () { $("input[name='check_all']").click(function () {
if ($(this).val() === '0') { if ($(this).val() === '0') {
$(this).parents("table") $(this).parents("table")
.find("input:checkbox") .find("input:checkbox")
.attr("checked", "checked"); .attr("checked", "checked");
$(this).val("1"); $(this).val("1");
} else { } else {
$(this).parents("table") $(this).parents("table")
.find("input:checkbox") .find("input:checkbox")
.attr("checked", ""); .attr("checked", "");
$(this).val("0"); $(this).val("0");
} }
}); });
/********************************************************************** /**********************************************************************
* Show full text of a comment in the batch moderation page. * Show full text of a comment in the batch moderation page.
**********************************************************************/ **********************************************************************/
$(".show-full-comment-text").click(function (e) { $(".show-full-comment-text").click(function (e) {
e.preventDefault(); e.preventDefault();
var target = $(this).attr("href"); var target = $(this).attr("href");
var td = $(this).parent(); var td = $(this).parent();
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: target, url: target,
data: "", data: "",
success: function (data) { success: function (data) {
// show full text // show full text
td.replaceWith("<td>" + data + "</td>"); td.replaceWith("<td>" + data + "</td>");
}, },
error: function (msg) { error: function (msg) {
alert("Error getting full comment text:" + target); alert("Error getting full comment text:" + target);
} }
}); });
}); });
}); });
//#JSCOVERAGE_ENDIF //#JSCOVERAGE_ENDIF
}(jQuery)); }(jQuery));