mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-25 04:16:12 +01:00
[FEATURE] Tea single view (#26)
This commit is contained in:
parent
3e4d10cc12
commit
3e1fd7416f
13 changed files with 95 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
namespace OliverKlee\Tea\Controller;
|
namespace OliverKlee\Tea\Controller;
|
||||||
|
|
||||||
|
use OliverKlee\Tea\Domain\Model\Product\Tea;
|
||||||
use OliverKlee\Tea\Domain\Repository\Product\TeaRepository;
|
use OliverKlee\Tea\Domain\Repository\Product\TeaRepository;
|
||||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||||
|
|
||||||
|
@ -34,4 +35,14 @@ class TeaController extends ActionController
|
||||||
{
|
{
|
||||||
$this->view->assign('teas', $this->teaRepository->findAll());
|
$this->view->assign('teas', $this->teaRepository->findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Tea $tea
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function showAction(Tea $tea)
|
||||||
|
{
|
||||||
|
$this->view->assign('tea', $tea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
<numIndex index="0">LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.index</numIndex>
|
<numIndex index="0">LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.index</numIndex>
|
||||||
<numIndex index="1">Tea->index</numIndex>
|
<numIndex index="1">Tea->index</numIndex>
|
||||||
</numIndex>
|
</numIndex>
|
||||||
|
<numIndex index="2" type="array">
|
||||||
|
<numIndex index="0">LLL:EXT:tea/Resources/Private/Language/locallang.xlf:plugin.tea.show</numIndex>
|
||||||
|
<numIndex index="1">Tea->show</numIndex>
|
||||||
|
</numIndex>
|
||||||
</items>
|
</items>
|
||||||
</config>
|
</config>
|
||||||
</TCEforms>
|
</TCEforms>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
return [
|
$tca = [
|
||||||
'ctrl' => [
|
'ctrl' => [
|
||||||
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea',
|
'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea',
|
||||||
'label' => 'title',
|
'label' => 'title',
|
||||||
|
@ -32,6 +32,7 @@ return [
|
||||||
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.description',
|
'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_product_tea.description',
|
||||||
'config' => [
|
'config' => [
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
|
'enableRichtext' => true,
|
||||||
'rows' => 8,
|
'rows' => 8,
|
||||||
'cols' => 40,
|
'cols' => 40,
|
||||||
'max' => 2000,
|
'max' => 2000,
|
||||||
|
@ -56,3 +57,9 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 8006000) {
|
||||||
|
$tca['columns']['description']['defaultExtras'] = 'richtext[]';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tca;
|
||||||
|
|
|
@ -16,6 +16,7 @@ plugin.tx_tea {
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
|
# cat=plugin.tx_tea//a; type=int; label=UID of the page with the single view
|
||||||
|
singleViewPageUid =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@ plugin.tx_tea {
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
|
singleViewPageUid = {$plugin.tx_tea.settings.singleViewPageUid}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
<source>Tea list</source>
|
<source>Tea list</source>
|
||||||
<target>Teeliste</target>
|
<target>Teeliste</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="plugin.tea.show">
|
||||||
|
<source>Tea single view</source>
|
||||||
|
<target>Tee-Einzelansicht</target>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="index.heading">
|
<trans-unit id="index.heading">
|
||||||
<source>Our selection of assorted teas</source>
|
<source>Our selection of assorted teas</source>
|
||||||
<target>Unsere Auswahl an erlesenen Tees</target>
|
<target>Unsere Auswahl an erlesenen Tees</target>
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
<trans-unit id="plugin.tea.index">
|
<trans-unit id="plugin.tea.index">
|
||||||
<source>Tea list</source>
|
<source>Tea list</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="plugin.tea.show">
|
||||||
|
<source>Tea single view</source>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="index.heading">
|
<trans-unit id="index.heading">
|
||||||
<source>Our selection of assorted teas</source>
|
<source>Our selection of assorted teas</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
{tea.uid}
|
{tea.uid}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{tea.title}
|
<f:link.action arguments="{tea: tea}" pageUid="{settings.singleViewPageUid}">
|
||||||
|
{tea.title}
|
||||||
|
</f:link.action>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</f:for>
|
</f:for>
|
||||||
|
|
12
Resources/Private/Templates/Tea/Show.html
Normal file
12
Resources/Private/Templates/Tea/Show.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:f="https://xsd.helhum.io/ns/typo3/cms-fluid/master/ViewHelpers" data-namespace-typo3-fluid="true">
|
||||||
|
<f:layout name="Default"/>
|
||||||
|
|
||||||
|
<f:section name="main">
|
||||||
|
<h2>
|
||||||
|
{tea.title}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{tea.description -> f:format.html()}
|
||||||
|
</f:section>
|
||||||
|
</html>
|
|
@ -3,7 +3,7 @@
|
||||||
<pages>
|
<pages>
|
||||||
<uid>1</uid>
|
<uid>1</uid>
|
||||||
<pid>0</pid>
|
<pid>0</pid>
|
||||||
<title>Root</title>
|
<title>Tea list</title>
|
||||||
<doktype>1</doktype>
|
<doktype>1</doktype>
|
||||||
<perms_everybody>15</perms_everybody>
|
<perms_everybody>15</perms_everybody>
|
||||||
</pages>
|
</pages>
|
||||||
|
@ -27,4 +27,31 @@
|
||||||
</T3FlexForms>
|
</T3FlexForms>
|
||||||
]]></pi_flexform>
|
]]></pi_flexform>
|
||||||
</tt_content>
|
</tt_content>
|
||||||
|
<pages>
|
||||||
|
<uid>2</uid>
|
||||||
|
<pid>1</pid>
|
||||||
|
<title>Tea single view</title>
|
||||||
|
<doktype>1</doktype>
|
||||||
|
<perms_everybody>15</perms_everybody>
|
||||||
|
</pages>
|
||||||
|
<tt_content>
|
||||||
|
<uid>2</uid>
|
||||||
|
<pid>2</pid>
|
||||||
|
<CType>list</CType>
|
||||||
|
<list_type>tea_tea</list_type>
|
||||||
|
<pi_flexform><![CDATA[
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
|
<T3FlexForms>
|
||||||
|
<data>
|
||||||
|
<sheet index="general">
|
||||||
|
<language index="lDEF">
|
||||||
|
<field index="switchableControllerActions">
|
||||||
|
<value index="vDEF">Tea->show</value>
|
||||||
|
</field>
|
||||||
|
</language>
|
||||||
|
</sheet>
|
||||||
|
</data>
|
||||||
|
</T3FlexForms>
|
||||||
|
]]></pi_flexform>
|
||||||
|
</tt_content>
|
||||||
</dataset>
|
</dataset>
|
||||||
|
|
|
@ -52,3 +52,9 @@ page {
|
||||||
file = EXT:tea/Tests/Functional/Controller/Fixtures/Frontend/Template.html
|
file = EXT:tea/Tests/Functional/Controller/Fixtures/Frontend/Template.html
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin.tx_tea {
|
||||||
|
settings {
|
||||||
|
singleViewPageUid = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace OliverKlee\Tea\Tests\Unit\Controller;
|
||||||
|
|
||||||
use Nimut\TestingFramework\TestCase\UnitTestCase;
|
use Nimut\TestingFramework\TestCase\UnitTestCase;
|
||||||
use OliverKlee\Tea\Controller\TeaController;
|
use OliverKlee\Tea\Controller\TeaController;
|
||||||
|
use OliverKlee\Tea\Domain\Model\Product\Tea;
|
||||||
use OliverKlee\Tea\Domain\Repository\Product\TeaRepository;
|
use OliverKlee\Tea\Domain\Repository\Product\TeaRepository;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
use Prophecy\Prophecy\ProphecySubjectInterface;
|
use Prophecy\Prophecy\ProphecySubjectInterface;
|
||||||
|
@ -75,4 +76,15 @@ class TeaControllerTest extends UnitTestCase
|
||||||
|
|
||||||
$this->subject->indexAction();
|
$this->subject->indexAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function showActionAssignsPassedTeaAsTeaToView()
|
||||||
|
{
|
||||||
|
$tea = new Tea();
|
||||||
|
$this->viewProphecy->assign('tea', $tea)->shouldBeCalled();
|
||||||
|
|
||||||
|
$this->subject->showAction($tea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
'Tea',
|
'Tea',
|
||||||
// all actions
|
// all actions
|
||||||
[
|
[
|
||||||
'Tea' => 'index',
|
'Tea' => 'index, show',
|
||||||
],
|
],
|
||||||
// non-cacheable actions
|
// non-cacheable actions
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue