Permalink
Browse files

[FIX] improve redirect and link generation for comments, adjust flash…

… message position
  • Loading branch information...
1 parent 82175ae commit 094eedabc4c97c324788ac10c62f4a5903087768 @fnagel committed Feb 9, 2014
@@ -123,7 +123,7 @@ public function createAction(Tx_T3extblog_Domain_Model_Post $post, Tx_T3extblog_
$this->addFlashMessage('Created');
}
- $this->redirect('show', 'Post', NULL, array_merge($post->getLinkParameter(), array('addedComment' => $newComment->getUid())));
+ $this->redirect('show', 'Post', NULL, $post->getLinkParameter());
}
/**
@@ -148,7 +148,11 @@ public function showAction(Tx_T3extblog_Domain_Model_Post $post = null, Tx_T3ext
$this->forward('list');
}
- // ToDo: This will not work as this action is cached
+ if ($newComment !== NULL) {
+ $this->forward('create', 'Comment');
+ }
+
+ // @todo: This will not work as this action is cached
$post->riseNumberOfViews();
if ($newComment === NULL) {
@@ -3,16 +3,17 @@
<t3b:frontend.commentAllowed post="{post}">
<f:then>
<f:form
- controller="Comment"
- action="create"
+ controller="Post"
+ action="show"
section="comment-section"
name="newComment"
object="{newComment}"
- arguments="{post: post}">
+ arguments="{post.linkParameter}">
<fieldset>
<legend><f:translate key="comment.new" /></legend>
+ <f:flashMessages />
<f:render partial="FormErrors" arguments="{object:Comment}" />
<f:render partial="Comment/FormFields" />
@@ -2,8 +2,6 @@
<f:section name="main">
- <f:flashMessages />
-
<f:render partial="Comment/New" arguments="{post: post, newComment: newComment}" />
</f:section>
@@ -42,7 +42,6 @@
<div id="comment-section">
<div class="well" id="comment-form">
- <f:flashMessages />
<f:render partial="Comment/New" arguments="{post: post, newComment: newComment}" />
</div>

0 comments on commit 094eeda

Please sign in to comment.