move jQuery code for comment actions from page template to moderation.js.

svn path=/plone.app.discussion/trunk/; revision=27721
This commit is contained in:
Timo Stollenwerk 2009-06-29 13:39:55 +00:00
parent 502015b14e
commit 2bc25c06de
2 changed files with 17 additions and 19 deletions

View File

@ -16,6 +16,23 @@ jq(document).ready(function() {
} }
}); });
/*****************************************************************
* Comment actions (delete, publish)
*****************************************************************/
jq('form.background-form').submit(function(e) {
e.preventDefault();
var target = jq(this).attr('action');
var params = jq(this).serialize();
var cell = jq(this).parent().get(0);
var row = jq(cell).parent().get(0);
jq.post(target, params, function(data) {
jq(row).fadeOut("normal", function() {
jq(this).remove();
});
});
});
/***************************************************************** /*****************************************************************
* Bulk actions * Bulk actions
*****************************************************************/ *****************************************************************/

View File

@ -7,25 +7,6 @@
i18n:domain="plone.app.discussion"> i18n:domain="plone.app.discussion">
<body> <body>
<metal:scripts fill-slot="javascript_head_slot">
<script type="text/javascript">
(function($) {$().ready(function() {
$('form.background-form').submit(function(e) {
e.preventDefault();
var target = $(this).attr('action');
var params = $(this).serialize();
var cell = $(this).parent().get(0);
var row = $(cell).parent().get(0);
$.post(target, params, function(data) {
$(row).fadeOut("normal", function() {
$(this).remove();
});
});
});
});})(jQuery);
</script>
</metal:scripts>
<metal:main fill-slot="main"> <metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main" <tal:main-macro metal:define-macro="main"
tal:define="items view/comments; tal:define="items view/comments;