remove the publish form when a comment is published in the view without a filter.

svn path=/plone.app.discussion/trunk/; revision=27726
This commit is contained in:
Timo Stollenwerk 2009-06-29 15:29:51 +00:00
parent a00dea41e3
commit be04439891

View File

@ -22,17 +22,22 @@ jq(document).ready(function() {
*****************************************************************/ *****************************************************************/
jq('form.background-form').submit(function(e) { jq('form.background-form').submit(function(e) {
e.preventDefault(); e.preventDefault();
var form = jq(this);
var target = jq(this).attr('action'); var target = jq(this).attr('action');
var params = jq(this).serialize(); var params = jq(this).serialize();
var cell = jq(this).parent().get(0); var cell = jq(this).parent().get(0);
var row = jq(cell).parent().get(0); var row = jq(cell).parent().get(0);
var currentFilter = jq(this).find("[name='form.button.Filter']").attr("value"); var currentFilter = jq(this).find("[name='form.button.Filter']").attr("value");
var currentAction = jq(this).attr("class"); var currentAction = jq(this).attr("class");
var publishButton = jq(this).find(".comment-publish-button");
jq.post(target, params, function(data) { jq.post(target, params, function(data) {
if (currentAction == 'background-form workflow_action' && currentFilter == '') { if (currentAction == 'background-form workflow_action' && currentFilter == '') {
alert("NotImplementedError: AJAX switch workflow state") // remove the publish button
} jq(publishButton).fadeOut("normal", function(){
else { jq(form).remove();
});
} else {
// remove the entire row
jq(row).fadeOut("normal", function(){ jq(row).fadeOut("normal", function(){
jq(this).remove(); jq(this).remove();
}); });
@ -58,15 +63,20 @@ jq(document).ready(function() {
// pending (because then publish also removes the comment), // pending (because then publish also removes the comment),
// remove all selected comments. // remove all selected comments.
if (currentAction == 'delete' || currentFilter == 'pending') { if (currentAction == 'delete' || currentFilter == 'pending') {
row = jq(this).parent().parent(); var row = jq(this).parent().parent();
row.fadeOut("normal", function() { row.fadeOut("normal", function() {
row.remove(); row.remove();
}); });
} }
// if bulkaction is publish and there is no current filter, // bulkaction is publish and there is no current filter
// change the workflow action if (currentAction == 'publish' && currentFilter == '') {
if (currentAction == 'publish') { // remove the publish button
alert("NotImplementedError: AJAX switch workflow state") var row = jq(this).parent().parent();
var form = row.find("form.workflow_action");
var publishButton = row.find(".comment-publish-button");
jq(publishButton).fadeOut("normal", function(){
jq(form).remove();
});
} }
}); });
}); });