Commit 52d2c996 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Use carousel for displaying other extensions

parent 72b582d6
Pipeline #11541 passed with stages
in 5 minutes and 55 seconds
......@@ -792,12 +792,27 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implement
public function getAdditionalSupportVersions(): array
{
$supportVersions = [];
$supportedVersions = $this->getAllSupportedVersions();
$supportVersionsOfLastVersion = $this->getLastVersion()->getMatrixOfSupportedTypo3Versions();
foreach ($supportedVersions as $key => $version) {
$test = $supportVersionsOfLastVersion[$key];
if (!empty($test)) {
unset($supportedVersions[$key]);
}
}
return $supportedVersions;
}
public function getAllSupportedVersions(): array
{
$supportedVersions = [];
$ltsVersionService = GeneralUtility::makeInstance(\T3o\TerFe2\Service\LTSVersionService::class);
foreach ($ltsVersionService->getOldLTSVersions() as $versionNumber) {
if (VersionUtility::doesExtensionSupportTypo3Version($this, $versionNumber)) {
$supportVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = [
$supportedVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = [
'label' => $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS',
'badgeClass' => 'danger'
];
......@@ -805,29 +820,21 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implement
}
foreach ($ltsVersionService->getELTSVersions() as $versionNumber) {
if (VersionUtility::doesExtensionSupportTypo3Version($this, $versionNumber)) {
$supportVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = ['label' => $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS', 'badgeClass' => 'warning'];
$supportedVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = ['label' => $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS', 'badgeClass' => 'warning'];
}
}
foreach ($ltsVersionService->getActiveVersions() as $versionNumber) {
if (VersionUtility::doesExtensionSupportTypo3Version($this, $versionNumber)) {
$supportVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = ['label' => $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS', 'badgeClass' => 'success'];
$supportedVersions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = ['label' => $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS', 'badgeClass' => 'success'];
}
}
if ($ltsVersionService->getLatestDevelopmentVersion(true) > VersionNumberUtility::convertVersionNumberToInteger($ltsVersionService->coreData['latest_lts'])
&& VersionUtility::doesExtensionSupportTypo3Version($this, $ltsVersionService->getLatestDevelopmentVersion(true))) {
$supportVersions[$ltsVersionService->getLatestDevelopmentVersion()] = ['label' => $ltsVersionService->getLatestDevelopmentVersion() . '-dev', 'badgeClass' => 'primary'];
}
array_unique($supportVersions);
$supportVersionsOfLastVersion = $this->getLastVersion()->getMatrixOfSupportedTypo3Versions();
foreach ($supportVersions as $key => $version) {
$test = $supportVersionsOfLastVersion[$key];
if (!empty($test)) {
unset($supportVersions[$key]);
}
$supportedVersions[$ltsVersionService->getLatestDevelopmentVersion()] = ['label' => $ltsVersionService->getLatestDevelopmentVersion() . '-dev', 'badgeClass' => 'primary'];
}
array_unique($supportedVersions);
return $supportVersions;
return $supportedVersions;
}
/**
......
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="text-center my-3">
<div class="row mx-auto my-auto">
<div id="extensionCarousel" class="carousel slide w-100" data-ride="carousel">
<div class="carousel-inner w-100" role="listbox">
<f:for each="{extensionsByUser}" iteration="it" as="extension">
<div class="carousel-item{f:if(condition:it.isFirst,then:' active')}">
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h5 class="card-title">
<terfe2:extensionIcon version="{extension.lastVersion}" alt="{extension.lastVersion.title}" class="ter-ext-icon" />
<f:link.action action="show" arguments="{extension: extension}">
<span title="Extension title: {extension.lastVersion.title}" itemprop="alternateName">
{extension.lastVersion.title}
</span>
</f:link.action>
<br>
<small>({extension.extKey})</small>
</h5>
</div>
<div class="card-body">
<p>{extension.lastVersion.description}</p>
<small>
Supported TYPO3 versions:<br>
<f:for each="{extension.allSupportedVersions}" as="version">
<button class="btn btn-{version.badgeClass} btn-sm mr-2" disabled title="{f:translate(key:'title_{version.badgeClass}', arguments: {0: version.label})}">{version.label}</button>
</f:for>
</small>
</div>
<div class="card-footer">
<small>
Last upload:
<f:format.date format="%d. %b %Y">@{extension.lastVersion.uploadDate}</f:format.date>
</small>
</div>
</div>
</div>
</div>
</f:for>
</div>
<a class="carousel-control-prev w-auto" href="#extensionCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon bg-primary border border-primary rounded-circle" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next w-auto" href="#extensionCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon bg-primary border border-primary rounded-circle" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</html>
......@@ -226,19 +226,9 @@
<f:render partial="InstallationHowTo" arguments="{_all}" />
<f:if condition="{extensionsByUser -> f:count()} >= 1">
<div class="ter-ext-single-otherextensions alert alert-info">
<h3>
<f:translate key="other_extensions_by_user" />
</h3>
<p class="tags">
<f:for each="{extensionsByUser}" as="extension">
<f:link.action controller="Extension" action="show" class="btn btn-info mb-1" arguments="{extension : extension}">
{extension.lastVersion.title} ({extension.extKey})
</f:link.action>
</f:for>
</p>
</div>
<f:if condition="{extensionsByUser -> f:count()} > 0">
<h3>Other extensions by this user</h3>
<f:render partial="OtherExtensionsByUser" arguments="{extensionsByUser: extensionsByUser}" />
</f:if>
......
......@@ -200,6 +200,32 @@ jQuery(document).ready(function ($) {
});
}
var extensionCarousel = $('#extensionCarousel');
if (extensionCarousel.length) {
extensionCarousel.carousel({
interval: 10000
});
$('.carousel .carousel-item').each(function () {
var minPerSlide = 3;
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
minPerSlide--;
for (var i = 1; i < minPerSlide; i++) {
next = next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});
}
});
function copyToClipboard(el) {
......
......@@ -119,3 +119,42 @@ span.ter-ext-state-expiremental {
.ter-ext-single-otherextensions .btn {
padding: .375rem .5rem;
}
@media (max-width: 768px) {
.carousel-inner .carousel-item > div {
display: none;
}
.carousel-inner .carousel-item > div:first-child {
display: block;
}
}
.carousel-inner .carousel-item.active,
.carousel-inner .carousel-item-next,
.carousel-inner .carousel-item-prev {
display: flex;
}
.carousel-inner .card-body {
display: block;
}
/* display 3 */
@media (min-width: 768px) {
.carousel-inner .carousel-item-right.active,
.carousel-inner .carousel-item-next {
transform: translateX(33.333%);
}
.carousel-inner .carousel-item-left.active,
.carousel-inner .carousel-item-prev {
transform: translateX(-33.333%);
}
}
.carousel-inner .carousel-item-right,
.carousel-inner .carousel-item-left {
transform: translateX(0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment