mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-25 06:56:12 +01:00

[FEATURE] Testimonial showAction

This commit is contained in:
Oliver Klee 2017-12-09 18:05:05 +01:00
parent a16ae8dac3
commit f4d5287239
4 changed files with 31 additions and 9 deletions

View file

@ -14,6 +14,7 @@ namespace OliverKlee\Tea\Controller;
* The TYPO3 project - inspiring people to share!
*/
use OliverKlee\Tea\Domain\Model\Testimonial;
use OliverKlee\Tea\Domain\Repository\TestimonialRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@ -48,4 +49,13 @@ class TestimonialController extends ActionController
{
$this->view->assign('testimonials', $this->testimonialRepository->findAll());
}
/**
* @param Testimonial $testimonial
*
* @return void
*/
public function showAction(Testimonial $testimonial) {
$this->view->assign('testimonial', $testimonial);
}
}

View file

@ -4,13 +4,12 @@
<h2><f:translate key="heading.testimonials"/></h2>
<f:for each="{testimonials}" as="testimonial">
<h3>
<f:format.printf arguments="{cups: testimonial.numberOfConsumedCups}">
<f:translate key="testimonials.cups.and.date"/>
</f:format.printf>
<f:format.date format="{f:translate(key: 'date-and-time-format')}">{testimonial.dateOfPosting}</f:format.date>
<f:link.action action="show" arguments="{testimonial: testimonial}">
<f:format.printf arguments="{cups: testimonial.numberOfConsumedCups}">
<f:translate key="testimonials.cups.and.date"/>
</f:format.printf>
<f:format.date format="{f:translate(key: 'date-and-time-format')}">{testimonial.dateOfPosting}</f:format.date>
</f:link.action>
</h3>
<f:format.html>
{testimonial.text}
</f:format.html>
</f:for>
</f:section>

View file

@ -0,0 +1,13 @@
<f:layout name="Default"/>
<f:section name="main">
<h3>
<f:format.printf arguments="{cups: testimonial.numberOfConsumedCups}">
<f:translate key="testimonials.cups.and.date"/>
</f:format.printf>
<f:format.date format="{f:translate(key: 'date-and-time-format')}">{testimonial.dateOfPosting}</f:format.date>
</h3>
<f:format.html>
{testimonial.text}
</f:format.html>
</f:section>

View file

@ -6,10 +6,10 @@ defined('TYPO3_MODE') or die('Access denied.');
'Tea',
// all actions
[
'Testimonial' => 'index',
'Testimonial' => 'index,show',
],
// non-cacheable actions
[
'Testimonial' => 'index',
'Testimonial' => '',
]
);