feat: render courses teaser only if applicable

This commit is contained in:
Björn Fromme
2024-11-15 08:31:29 +01:00
parent 14ae6a319a
commit eddad77f48
6 changed files with 74 additions and 40 deletions
@@ -134,6 +134,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $servicesGeneral = '';
/**
* @var string
*/
protected $coursesIncluded = '';
/**
* @var string
*/
@@ -470,6 +475,18 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->servicesGeneral = serialize($servicesGeneral);
}
public function getCoursesIncluded()
{
return unserialize($this->coursesIncluded);
}
public function setCoursesIncluded($coursesIncluded)
{
$this->coursesIncluded = $coursesIncluded;
return $this;
}
/**
* @return string
*/
@@ -20,7 +20,7 @@ class TravelinfoTeaser extends AbstractEntity
/**
* @var string
*/
protected $icon;
protected $category;
/**
* @var FileReference
@@ -53,14 +53,14 @@ class TravelinfoTeaser extends AbstractEntity
$this->bodytext = $bodytext;
}
public function getIcon()
public function getCategory()
{
return $this->icon;
return $this->category;
}
public function setIcon($icon)
public function setCategory($category)
{
$this->icon = $icon;
$this->category = $category;
}
public function getImage()
@@ -394,6 +394,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
];
$date['services_included'] = serialize($includedServices);
$date['courses_included'] = serialize($includedCourses);
if ($includedBoard) {
$date['board'] = implode(', ', $includedBoard);
@@ -27,7 +27,7 @@ return [
],
],
'palettes' => [
'basics' => ['showitem' => 'title,icon,hidden'],
'basics' => ['showitem' => 'title,category,hidden'],
],
'columns' => [
@@ -173,9 +173,9 @@ return [
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'icon' => [
'category' => [
'exclude' => 0,
'label' => 'Icon',
'label' => 'Kategorie/Icon',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
@@ -190,6 +190,8 @@ return [
['Wetter', 'weather'],
['Wissenswertes', 'chat'],
],
'maxitems' => 1,
'minitems' => 1,
],
],
'tx_epproducts_travelinfo' => [
@@ -119,6 +119,7 @@ CREATE TABLE tx_epproducts_domain_model_date
bus_price int(11) DEFAULT '0' NOT NULL,
services_included text NOT NULL,
services_general text NOT NULL,
courses_included text NOT NULL,
pickups text NOT NULL,
discount int(11) DEFAULT '0' NOT NULL,
min_price int(11) DEFAULT '0' NOT NULL,
@@ -1420,7 +1421,7 @@ CREATE TABLE tx_epproducts_domain_model_travelinfoteaser
title varchar(255) DEFAULT '' NOT NULL,
bodytext text DEFAULT '0' NOT NULL,
image int(11) DEFAULT '0' NOT NULL,
icon varchar(255) DEFAULT '' NOT NULL,
category varchar(255) DEFAULT '' NOT NULL,
tx_epproducts_travelinfo int(11) unsigned DEFAULT '0' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
@@ -114,37 +114,16 @@
<div class="container px-4 lg:px-24 flex flex-col space-y-16 pb-16">
<f:for each="{travelinfo.teasers}" as="teaser">
<div class="grid grid-cols-1 md:grid-cols-3 gap-x-8"
data-controller="autocollapse"
data-autocollapse-offset-value="64">
<div class="relative self-start" data-autocollapse-target="sizer">
<f:image image="{teaser.image}" width="640" alt="" class="block w-full h-auto" />
<div class="absolute top-0 left-0 inset-0 bg-ep-primary/25 flex items-center justify-center">
<div class="w-32 h-32 xl:w-48 xl:h-48 text-white">
<f:render section="Icon" arguments="{icon: teaser.icon}"/>
</div>
</div>
</div>
<div class="md:col-span-2 relative p-4 md:p-0 md:pb-4 border border-gray-300 md:border-none">
<div class="pb-8"
data-autocollapse-target="container"
data-rte-content>
<h2 class="headline--primary">
{teaser.title}
</h2>
{teaser.bodytext -> f:format.html()}
</div>
<div class="absolute left-0 bottom-0 w-full bg-gradient-to-b from-transparent via-white via-20% to-white pt-2 md:pt-0">
<button type="button"
data-autocollapse-target="button"
data-action="autocollapse#toggle"
class="hidden text-ep-primary w-12 h-12 ml-4 md:ml-0 group toggle-more">
<f:render section="Icon" arguments="{icon: 'toggle'}" />
</button>
<div class="bg-ep-primary w-full md:w-1/3 h-1"></div>
</div>
</div>
</div>
<f:if condition="{teaser.category} == 'course'">
<f:then>
<f:if condition="{date.coursesIncluded}">
<f:render section="Teaser" arguments="{_all}"/>
</f:if>
</f:then>
<f:else>
<f:render section="Teaser" arguments="{_all}"/>
</f:else>
</f:if>
</f:for>
</div>
<div id="goodtoknow" class="bg-ep-primary-bg">
@@ -199,6 +178,40 @@
</div>
</f:section>
<f:section name="Teaser">
<div class="grid grid-cols-1 md:grid-cols-3 gap-x-8"
data-controller="autocollapse"
data-autocollapse-offset-value="64">
<div class="relative self-start" data-autocollapse-target="sizer">
<f:image image="{teaser.image}" width="640" alt="" class="block w-full h-auto" />
<div class="absolute top-0 left-0 inset-0 bg-ep-primary/25 flex items-center justify-center">
<div class="w-32 h-32 xl:w-48 xl:h-48 text-white">
<f:render section="Icon" arguments="{icon: teaser.category}"/>
</div>
</div>
</div>
<div class="md:col-span-2 relative p-4 md:p-0 md:pb-4 border border-gray-300 md:border-none">
<div class="pb-8"
data-autocollapse-target="container"
data-rte-content>
<h2 class="headline--primary">
{teaser.title}
</h2>
{teaser.bodytext -> f:format.html()}
</div>
<div class="absolute left-0 bottom-0 w-full bg-gradient-to-b from-transparent via-white via-20% to-white pt-2 md:pt-0">
<button type="button"
data-autocollapse-target="button"
data-action="autocollapse#toggle"
class="hidden text-ep-primary w-12 h-12 ml-4 md:ml-0 group toggle-more">
<f:render section="Icon" arguments="{icon: 'toggle'}" />
</button>
<div class="bg-ep-primary w-full md:w-1/3 h-1"></div>
</div>
</div>
</div>
</f:section>
<f:section name="Link">
<f:link.typolink parameter="{item.link}" class="flex flex-col space-y-4 items-center justify-center px-4 py-4 lg:py-16 text-white {color}">
<div class="w-10 h-10 lg:w-24 lg:h-24">