Make sure the moderation JS functions are executed after the page is fully loaded.

svn path=/plone.app.discussion/trunk/; revision=40215
This commit is contained in:
Timo Stollenwerk 2010-09-24 14:57:19 +00:00
parent 399bba5eca
commit 2ff95fe847
2 changed files with 140 additions and 122 deletions

View File

@ -4,7 +4,6 @@
* *
******************************************************************************/ ******************************************************************************/
(function ($) { (function ($) {
// 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 $.

View File

@ -1,9 +1,25 @@
/******************************************************************************
*
* jQuery functions for the plone.app.discussion bulk moderation.
*
******************************************************************************/
(function ($) { (function ($) {
// This unnamed function allows us to use $ inside of a block of code
// without permanently overwriting $.
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries
//#JSCOVERAGE_IF 0
/************************************************************************** /**************************************************************************
* Delete a single comment. * Window Load Function: Executes when complete page is fully loaded,
* including all frames,
**************************************************************************/ **************************************************************************/
$(window).load(function () {
/**********************************************************************
* 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);
@ -28,9 +44,9 @@
}); });
/************************************************************************** /**********************************************************************
* 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);
@ -55,9 +71,9 @@
}); });
/************************************************************************** /**********************************************************************
* 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");
@ -88,9 +104,9 @@
}); });
/************************************************************************** /**********************************************************************
* 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")
@ -106,9 +122,9 @@
}); });
/************************************************************************** /**********************************************************************
* 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");
@ -127,5 +143,8 @@
}); });
}); });
}(jQuery)); });
//#JSCOVERAGE_ENDIF
}(jQuery));