Skip to content
Code-Schnipsel Gruppen Projekte
Commit 7a9c9c28 erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

fix: improve timeline control

Übergeordneter d3d7e6af
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!8Update 'next-3.x' with latest changes from 'main',!7Next 2.x
Pipeline-Nr. 12390 mit Warnungen bestanden
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
<de><![CDATA[Bild verhalten]]></de> <de><![CDATA[Bild verhalten]]></de>
<en><![CDATA[Bild mode]]></en> <en><![CDATA[Bild mode]]></en>
</locale> </locale>
<locale name="brick.timeline.setting.imageFillMode.desc">
<de><![CDATA[Die Einstellung bezieht sich nur auf die Bilder, nicht auf die Icons]]></de>
<en><![CDATA[The setting refers only to the images, not to the icons]]></en>
</locale>
<locale name="brick.timeline.setting.imageFillMode.cover"> <locale name="brick.timeline.setting.imageFillMode.cover">
<de><![CDATA[Ganze Fläche füllen. Das Bild kann u.U. gestreckt werden (cover)]]></de> <de><![CDATA[Ganze Fläche füllen. Das Bild kann u.U. gestreckt werden (cover)]]></de>
<en><![CDATA[Fill entire area. The image can be stretched (cover)]]></en> <en><![CDATA[Fill entire area. The image can be stretched (cover)]]></en>
...@@ -98,22 +102,22 @@ ...@@ -98,22 +102,22 @@
<en><![CDATA[Show links to the pages?]]></en> <en><![CDATA[Show links to the pages?]]></en>
</locale> </locale>
<!-- image fit --> <!-- image fill mode -->
<locale name="timeline.imageFit"> <locale name="timeline.setting.imageFillMode">
<de><![CDATA[Bild]]></de> <de><![CDATA[Bild verhalten]]></de>
<en><![CDATA[Image]]></en> <en><![CDATA[Bild mode]]></en>
</locale> </locale>
<locale name="timeline.imageFit.desc"> <locale name="timeline.setting.imageFillMode.desc">
<de><![CDATA[Die Einstellung bezieht sich nur auf die Bilder, nicht auf die Icons]]></de> <de><![CDATA[Die Einstellung bezieht sich nur auf die Bilder, nicht auf die Icons]]></de>
<en><![CDATA[The setting refers only to the images, not to the icons]]></en> <en><![CDATA[The setting refers only to the images, not to the icons]]></en>
</locale> </locale>
<locale name="timeline.imageFit.original"> <locale name="timeline.setting.imageFillMode.cover">
<de><![CDATA[Original]]></de> <de><![CDATA[Ganze Fläche füllen. Das Bild kann u.U. gestreckt werden (cover)]]></de>
<en><![CDATA[Original]]></en> <en><![CDATA[Fill entire area. The image can be stretched (cover)]]></en>
</locale> </locale>
<locale name="timeline.imageFit.cover"> <locale name="timeline.setting.imageFillMode.contain">
<de><![CDATA[Decken (Bild kann gestreckt werden)]]></de> <de><![CDATA[Ganzes Bild anzeigen (contain)]]></de>
<en><![CDATA[Cover (image can be stretched)]]></en> <en><![CDATA[Show full image (contain)]]></en>
</locale> </locale>
<!-- counter text --> <!-- counter text -->
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<!-- list attributes --> <!-- list attributes -->
<attributes> <attributes>
<attribute default="VerticalBothSides">quiqqer.timeline.display</attribute> <attribute default="VerticalBothSides">quiqqer.timeline.display</attribute>
<attribute default="1">quiqqer.timeline.showLinks</attribute> <attribute default="0">quiqqer.timeline.showLinks</attribute>
<attribute default="original">quiqqer.timeline.imageFit</attribute> <attribute default="cover">quiqqer.timeline.imageFillMode</attribute>
</attributes> </attributes>
<!-- list settings --> <!-- list settings -->
...@@ -44,23 +44,23 @@ ...@@ -44,23 +44,23 @@
</text> </text>
</input> </input>
<select conf="quiqqer.timeline.imageFit"> <select conf="quiqqer.timeline.imageFillMode">
<text> <text>
<locale group="quiqqer/timeline" <locale group="quiqqer/timeline"
var="timeline.imageFit"/> var="timeline.setting.imageFillMode"/>
</text> </text>
<description> <description>
<locale group="quiqqer/timeline" <locale group="quiqqer/timeline"
var="timeline.imageFit.desc"/> var="timeline.setting.imageFillMode.desc"/>
</description> </description>
<option value="original"> <option value="cover">
<locale group="quiqqer/timeline" <locale group="quiqqer/timeline"
var="timeline.imageFit.original"/> var="timeline.setting.imageFillMode.cover"/>
</option> </option>
<option value="cover"> <option value="contain">
<locale group="quiqqer/timeline" <locale group="quiqqer/timeline"
var="timeline.imageFit.cover"/> var="timeline.setting.imageFillMode.contain"/>
</option> </option>
</select> </select>
......
...@@ -11,5 +11,5 @@ ...@@ -11,5 +11,5 @@
{/if} {/if}
<div class="control-template"> <div class="control-template">
{$timelineHtml} {$TimelineControl->create()}
</div> </div>
...@@ -49,27 +49,26 @@ public function getBody(): string ...@@ -49,27 +49,26 @@ public function getBody(): string
$limit = $this->getAttribute('limit'); $limit = $this->getAttribute('limit');
if ($limit === '') { if (!$limit || $limit < 1) {
$limit = 10; $limit = 10;
} }
if ($limit <= 0) { $attributes = [
$limit = 1; 'parentInputList' => $this->getAttribute('site'),
} 'imageFillMode' => $this->getAttribute('imageFillMode'),
'order' => $this->getAttribute('order'),
'showLinks' => $this->getAttribute('showLinks'),
'display' => $this->getAttribute('template'),
'limit' => $limit,
];
$Control->setAttribute('parentInputList', $this->getAttribute('site')); $Control->setAttributes($attributes);
$Control->setAttribute('imageFillMode', $this->getAttribute('imageFillMode'));
$Control->setAttribute('order', $this->getAttribute('order'));
$Control->setAttribute('showLinks', $this->getAttribute('showLinks'));
$Control->setAttribute('display', $this->getAttribute('template'));
$Control->setAttribute('limit', $limit);
$html = $Control->create();
$this->addCSSFiles($Control->getCSSFiles()); $this->addCSSFiles($Control->getCSSFiles());
$options = [ $options = [
'this' => $this, 'this' => $this,
'timelineHtml' => $html 'TimelineControl' => $Control
]; ];
$Engine->assign($options); $Engine->assign($options);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
.timeline-entry-icon-wrapper { .timeline-entry-icon-wrapper {
color: #aaa; color: #aaa;
font-size: 53px; font-size: 53px;
border: 8px solid #aaa; border: 8px solid var(--_qui-timeline-timeline__borderColor);
text-align: center; text-align: center;
height: 120px; height: 120px;
width: 120px; width: 120px;
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
border-right: none; border-right: none;
border-bottom: 20px solid transparent; border-bottom: 20px solid transparent;
border-top: 20px solid transparent; border-top: 20px solid transparent;
border-left: 30px solid #aaa; border-left: 30px solid var(--_qui-timeline-timeline__borderColor);
} }
/* image */ /* image */
...@@ -62,11 +62,10 @@ ...@@ -62,11 +62,10 @@
justify-content: center; justify-content: center;
} }
.timeline-entry-icon-wrapper picture img.image-fit-cover { .timeline-entry__image {
object-fit: cover; object-fit: var(--_qui-timeline-timeline-imageFillMode);
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
/* line - middle */ /* line - middle */
...@@ -96,7 +95,7 @@ ...@@ -96,7 +95,7 @@
height: 12px; height: 12px;
background: none; background: none;
border-radius: 16px; border-radius: 16px;
border: 2px solid #999; border: 2px solid var(--_qui-timeline-timeline__borderColor);
} }
.timeline-entry-line-caption-number { .timeline-entry-line-caption-number {
...@@ -111,7 +110,6 @@ ...@@ -111,7 +110,6 @@
position: relative; position: relative;
} }
/* text content */ /* text content */
.timeline-entry-desc { .timeline-entry-desc {
padding-left: 40px; padding-left: 40px;
...@@ -133,10 +131,7 @@ ...@@ -133,10 +131,7 @@
font-size: 16px; font-size: 16px;
} }
/* nth child */ /* nth child */
/*************/
.timeline-entry:nth-child(2n+2) .timeline-entry-desc { .timeline-entry:nth-child(2n+2) .timeline-entry-desc {
order: 1; order: 1;
padding-left: 0; padding-left: 0;
...@@ -150,7 +145,7 @@ ...@@ -150,7 +145,7 @@
.timeline-entry:nth-child(2n+2) .timeline-entry-icon-wrapper:after { .timeline-entry:nth-child(2n+2) .timeline-entry-icon-wrapper:after {
right: auto; right: auto;
left: -30px; left: -30px;
border-right: 30px solid #aaa; border-right: 30px solid var(--_qui-timeline-timeline__borderColor);
border-left: none; border-left: none;
} }
...@@ -165,62 +160,28 @@ ...@@ -165,62 +160,28 @@
content: ''; content: '';
} }
/* colors */
/* FARBEN */ .timeline-entry:nth-child(5n+1) {
/* 1 */ --_qui-timeline-timeline__borderColor: var(--qui-timeline-timeline__borderColor, #f08080);
.timeline-entry:nth-child(5n+1) .timeline-entry-icon-wrapper,
.timeline-entry:nth-child(5n+1) .timeline-entry-line-caption:after {
border-color: lightcoral;
}
.timeline-entry:nth-child(5n+1) .timeline-entry-icon-wrapper:after {
border-left-color: lightcoral;
border-right-color: lightcoral;
} }
/* 2 */ .timeline-entry:nth-child(5n+2) {
.timeline-entry:nth-child(5n+2) .timeline-entry-icon-wrapper, --_qui-timeline-timeline__borderColor: var(--qui-timeline-timeline__borderColor, #add8e6);
.timeline-entry:nth-child(5n+2) .timeline-entry-line-caption:after {
border-color: lightblue;
}
.timeline-entry:nth-child(5n+2) .timeline-entry-icon-wrapper:after {
border-left-color: lightblue;
border-right-color: lightblue;
} }
/* 3 */ .timeline-entry:nth-child(5n+3) {
.timeline-entry:nth-child(5n+3) .timeline-entry-icon-wrapper, --_qui-timeline-timeline__borderColor: var(--qui-timeline-timeline__borderColor, #ffa07a);
.timeline-entry:nth-child(5n+3) .timeline-entry-line-caption:after {
border-color: lightsalmon;
}
.timeline-entry:nth-child(5n+3) .timeline-entry-icon-wrapper:after {
border-left-color: lightsalmon;
border-right-color: lightsalmon;
} }
/* 4 */ .timeline-entry:nth-child(5n+4) {
.timeline-entry:nth-child(5n+4) .timeline-entry-icon-wrapper, --_qui-timeline-timeline__borderColor: var(--qui-timeline-timeline__borderColor, #1fb2aa);
.timeline-entry:nth-child(5n+4) .timeline-entry-line-caption:after {
border-color: lightseagreen;
}
.timeline-entry:nth-child(5n+4) .timeline-entry-icon-wrapper:after {
border-left-color: lightseagreen;
border-right-color: lightseagreen;
} }
/* 5 */ .timeline-entry:nth-child(5n+5) {
.timeline-entry:nth-child(5n+5) .timeline-entry-icon-wrapper, --_qui-timeline-timeline__borderColor: var(--qui-timeline-timeline__borderColor, #9acd32);
.timeline-entry:nth-child(5n+5) .timeline-entry-line-caption:after {
border-color: yellowgreen;
}
.timeline-entry:nth-child(5n+5) .timeline-entry-icon-wrapper:after {
border-left-color: yellowgreen;
border-right-color: yellowgreen;
} }
/***************/
/* media query */ /* media query */
/***************/
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
.timeline-entry:nth-child(2n+2) .timeline-entry-desc { .timeline-entry:nth-child(2n+2) .timeline-entry-desc {
order: 3; order: 3;
......
...@@ -26,18 +26,13 @@ ...@@ -26,18 +26,13 @@
itemtype="{$this->getAttribute('child-itemtype')}" itemtype="{$this->getAttribute('child-itemtype')}"
class="timeline-entry" class="timeline-entry"
> >
{assign var=imageFitClass value=''}
{if $imageFit == 'cover'}
{assign var=imageFitClass value='image-fit-cover'}
{/if}
<!-- Entry Icon --> <!-- Entry Icon -->
<div class="timeline-entry-icon"> <div class="timeline-entry-icon">
{if $Child->getAttribute('image_site')} {if $Child->getAttribute('image_site')}
<div class="timeline-entry-icon-wrapper"> <div class="timeline-entry-icon-wrapper">
{image src=$Child->getAttribute('image_site') max-width="500" max-height="500" type="resize" {image src=$Child->getAttribute('image_site') max-width="500" max-height="500" type="resize"
title="{$Child->getAttribute('title')}" title="{$Child->getAttribute('title')}"
class="$imageFitClass"} class="timeline-entry__image"}
</div> </div>
{/if} {/if}
</div> </div>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace QUI\Timeline\Controls; namespace QUI\Timeline\Controls;
use QUI; use QUI;
use QUI\Exception;
use QUI\Projects\Site\Utils; use QUI\Projects\Site\Utils;
/** /**
...@@ -56,21 +57,13 @@ public function getBody(): string ...@@ -56,21 +57,13 @@ public function getBody(): string
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite(); $Site = $this->getSite();
$Project = $this->getProject(); $Project = $this->getProject();
$limit = $this->getAttribute('limit');
if (!$Site && !$this->getAttribute('parentInputList')) { if (!$Site && !$this->getAttribute('parentInputList')) {
return ''; return '';
} }
if (!$limit) { $limit = $this->getAttribute('limit') ?: 10;
$limit = 10; $parents = $this->getAttribute('parentInputList') ?: $Site->getId();
}
$parents = $this->getAttribute('parentInputList');
if (!$parents) {
$parents = $Site->getId();
}
// only active sites // only active sites
$where['active'] = 1; $where['active'] = 1;
...@@ -100,6 +93,10 @@ public function getBody(): string ...@@ -100,6 +93,10 @@ public function getBody(): string
'imageFit' => $this->getAttribute('imageFillMode') 'imageFit' => $this->getAttribute('imageFillMode')
]); ]);
if ($this->getAttribute('imageFillMode')) {
$this->setCustomVariable('imageFillMode', $this->getAttribute('imageFillMode'));
}
// load custom template (if set) // load custom template (if set)
if ( if (
$this->getAttribute('displayTemplate') $this->getAttribute('displayTemplate')
...@@ -115,19 +112,19 @@ public function getBody(): string ...@@ -115,19 +112,19 @@ public function getBody(): string
return $Engine->fetch($this->getAttribute('displayTemplate')); return $Engine->fetch($this->getAttribute('displayTemplate'));
} }
// Load default template
$cssFile = dirname(__FILE__) . '/Timeline.' . $this->getAttribute('display') . '.css';
$templateFile = dirname(__FILE__) . '/Timeline.' . $this->getAttribute('display') . '.html';
// template $this->addCSSFile($cssFile);
$css = dirname(__FILE__) . '/Timeline.' . $this->getAttribute('display') . '.css';
$template = dirname(__FILE__) . '/Timeline.' . $this->getAttribute('display') . '.html';
$this->addCSSFile($css);
return $Engine->fetch($template); return $Engine->fetch($templateFile);
} }
/** /**
* @return null|QUI\Projects\Site * @return null|QUI\Projects\Site
* @throws Exception
*/ */
protected function getSite(): ?QUI\Interfaces\Projects\Site protected function getSite(): ?QUI\Interfaces\Projects\Site
{ {
...@@ -141,4 +138,28 @@ protected function getSite(): ?QUI\Interfaces\Projects\Site ...@@ -141,4 +138,28 @@ protected function getSite(): ?QUI\Interfaces\Projects\Site
return $Site; return $Site;
} }
/**
* Set custom css variable to the control as inline style
* --_qui-timeline-timeline-$name: var(--qui-timeline-timeline-$name, $value);
*
* Example:
* --_qui-timeline-timeline-imageFillMode: var(--qui-timeline-timeline-imageFillMode, 'cover');
*
* @param string $name
* @param string $value
*
* @return void
*/
private function setCustomVariable(string $name, string $value): void
{
if (!$name || !$value) {
return;
}
$this->setStyle(
'--_qui-timeline-timeline-' . $name,
'var(--qui-timeline-timeline-' . $name . ', ' . $value . ')'
);
}
} }
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren