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

feat: Site category has new setting: template (default and accordeon menu).

Übergeordneter ff747c37
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -69,8 +69,24 @@
<en><![CDATA[Offset]]></en>
</locale>
<locale name="quiqqer.faq.category.settings.offset.desc">
<de><![CDATA[Der Versatz (in Pixel) sagt, um wie viele zusätzliche Pixel soll die Seite gescrollt werden, wenn man ein FAQ Titel anklickt. Das ist vor allem dann hilfreich, wenn das Menü den Inhalt verdecken würde.]]></de>
<en><![CDATA[The offset (in pixels) specifies how many additional pixels the page should scroll when you click on a FAQ title. By doing this the menu no longer hides the linked content.]]></en>
<de><![CDATA[Der Versatz (in Pixel) sagt, um wie viele zusätzliche Pixel soll die Seite gescrollt werden, wenn man ein FAQ Titel anklickt. Das ist vor allem dann hilfreich, wenn das Menü den Inhalt verdecken würde. Es funktioniert nur im Standard-Template.]]></de>
<en><![CDATA[The offset (in pixels) specifies how many additional pixels the page should scroll when you click on a FAQ title. By doing this the menu no longer hides the linked content. It takes affect in default template.]]></en>
</locale>
<locale name="quiqqer.faq.category.settings.template">
<de><![CDATA[Template]]></de>
<en><![CDATA[Template]]></en>
</locale>
<locale name="quiqqer.faq.category.settings.template.default">
<de><![CDATA[Standard]]></de>
<en><![CDATA[Default]]></en>
</locale>
<locale name="quiqqer.faq.category.settings.template.accordion">
<de><![CDATA[FAQ Akkordeon Menü]]></de>
<en><![CDATA[FAQ Accordion Menu]]></en>
</locale>
<locale name="quiqqer.faq.settings.accordion.stayOpen">
<de><![CDATA[FAQ Akkordeon Menü: Einträge bleiben auf]]></de>
<en><![CDATA[FAQ Accordion Menu: Entries stay open]]></en>
</locale>
<!-- Brick: FAQ Accordion Menu -->
......@@ -127,7 +143,7 @@
<en><![CDATA[Show "more entries" button]]></en>
</locale>
<locale name="brick.accordion.settings.showMoreButton.desc" html="true">
<de><![CDATA[Der Button wird nicht angezeigt, wenn es nicht mehr Einträgen gibt, als der Baustein anzeigt. Wenn der Baustein 10 Einträge listet aber es nur 5 FAQ Einträgen gibt, wird kein Button angezeigt. Bitte die Einstellungn <strong>"Maximale Anzahl der Einträge"</strong> beachten.]]></de>
<de><![CDATA[Der Button wird nicht angezeigt, wenn es nicht mehr Einträge gibt, als der Baustein anzeigt. Wenn der Baustein 10 Einträge listet aber es nur 5 FAQ Einträgen gibt, wird kein Button angezeigt. Bitte die Einstellungn <strong>"Maximale Anzahl der Einträge"</strong> beachten.]]></de>
<en><![CDATA[The button is not displayed if there are not more entries than the brick displays. If the brick lists 10 entries and there are only 5 faq entries, no button will be displayed. Please note the <strong>"Maximum number of entries"</strong> setting.]]></en>
</locale>
<locale name="brick.accordion.button.more">
......
......@@ -16,6 +16,8 @@
</desc>
<attributes>
<attribute default="default">quiqqer.faq.settings.template</attribute>
<attribute default="1">quiqqer.faq.settings.accordion.stayOpen</attribute>
<attribute default="0">quiqqer.faq.settings.offset</attribute>
</attributes>
......@@ -26,6 +28,24 @@
<locale group="quiqqer/faq" var="quiqqer.faq.category.settings.title"/>
</title>
<select conf="quiqqer.faq.settings.template">
<text>
<locale group="quiqqer/faq" var="quiqqer.faq.category.settings.template"/>
</text>
<option value="default">
<locale group="quiqqer/faq" var="quiqqer.faq.category.settings.template.default"/>
</option>
<option value="accordion">
<locale group="quiqqer/faq" var="quiqqer.faq.category.settings.template.accordion"/>
</option>
</select>
<input conf="quiqqer.faq.settings.accordion.stayOpen" type="checkbox">
<text>
<locale group="quiqqer/faq" var="quiqqer.faq.settings.accordion.stayOpen"/>
</text>
</input>
<input conf="quiqqer.faq.settings.offset" type="number">
<text>
<locale group="quiqqer/faq" var="quiqqer.faq.category.settings.offset"/>
......
......@@ -122,7 +122,7 @@ class Accordion extends QUI\Control
}
$Accordion = new QUI\Bricks\Controls\Accordion([
'stayOpen' => $this->getAttribute('stayOpen'),
'stayOpen' => \boolval($this->getAttribute('stayOpen')),
'openFirst' => $this->getAttribute('openFirst'),
'listMaxWidth' => $this->getAttribute('listMaxWidth'),
'entries' => $entries
......
{if $Template->getAttribute('content-body') && $Site->getAttribute('content')}
<section class="content-body">
{$Site->getAttribute('content')}
</section>
<section class="content-body">
{$Site->getAttribute('content')}
</section>
{/if}
{if $offset}
<!--
This CSS is used to scroll the page down a bit when accessed with a # in the url.
By doing this the menu no longer hides the linked content.
-->
<style type="text/css">
:target::before {
content: '';
display: block;
height: 80px;
margin-top: -80px;
}
</style>
{/if}
<section itemscope itemtype="http://schema.org/ItemList"
class="content-template quiqqer-faq clear-fix"
data-qui="package/quiqqer/faq/bin/Category"
data-qui-options-offset="{$offset}"
>
{if count($entries)}
<ul class="quiqqer-faq-list" id="faqList" name="faqList">
{foreach $entries as $Faq}
<li>
<a href="{url site=$Site}#faq{$Faq->getId()}">
{$Faq->getAttribute('title')}
</a>
</li>
{/foreach}
</ul>
{* Template: default*}
{if $faqTemplate == 'default'}
{if $offset}
{*
This CSS is used to scroll the page down a bit when accessed with a # in the url.
By doing this the menu no longer hides the linked content.
*}
<style type="text/css">
:target::before {
content: '';
display: block;
height: {$offset}px;
margin-top: -{$offset}px;
}
</style>
{/if}
<hr />
<section itemscope itemtype="http://schema.org/ItemList"
class="content-template quiqqer-faq clear-fix"
data-qui="package/quiqqer/faq/bin/Category"
data-qui-options-offset="{$offset}"
>
{if count($entries)}
<ul class="quiqqer-faq-list" id="faqList" name="faqList">
{foreach $entries as $Faq}
<li>
<a href="{url site=$Site}#faq{$Faq->getId()}">
{$Faq->getAttribute('title')}
</a>
</li>
{/foreach}
</ul>
{/if}
{foreach $entries as $Faq}
<article id="faq{$Faq->getId()}" class="clear-fix">
<header>
<h2>{$Faq->getAttribute('title')}</h2>
</header>
<hr />
{if $Faq->getAttribute('short')}
<div class="content-short">
{$Faq->getAttribute('short')|nl2br}
</div>
{/if}
{foreach $entries as $Faq}
<article id="faq{$Faq->getId()}" class="clear-fix">
<header>
<h2>{$Faq->getAttribute('title')}</h2>
</header>
<div class="content-body">
{$Faq->getAttribute('content')}
</div>
{if $Faq->getAttribute('short')}
<div class="content-short">
{$Faq->getAttribute('short')|nl2br}
</div>
{/if}
<a href="#faqList" class="quiqqer-faq-list-linkToTop">
{locale group="quiqqer/faq" value="link.to.top"} <span class="fa fa-fw fa-level-up"></span>
</a>
<div class="content-body">
{$Faq->getAttribute('content')}
</div>
</article>
<a href="#faqList" class="quiqqer-faq-list-linkToTop">
{locale group="quiqqer/faq" value="link.to.top"} <span class="fa fa-fw fa-level-up"></span>
</a>
{if !($Faq@last)}
<hr />
{/if}
</article>
{/foreach}
{if !($Faq@last)}
<hr />
{/if}
{/foreach}
</section>
{/if}
</section>
{* Template: accordion*}
{if $faqTemplate == 'accordion'}
<section class="content-template quiqqer-faq">
{$FAQControl->create()}
</section>
{/if}
\ No newline at end of file
<?php
$entries = $Site->getChildren(array(
$entries = $Site->getChildren([
'type' => 'quiqqer/faq:types/entry'
));
]);
$offset = intval($Site->getAttribute('quiqqer.faq.settings.offset'));
$faqTemplate = 'default';
$offset = false;
$FAQControl = null;
$Engine->assign(array(
'entries' => $entries,
'offset' => $offset
));
switch ($Site->getAttribute('quiqqer.faq.settings.template')) {
case 'accordion':
$faqTemplate = 'accordion';
$FAQControl = new \QUI\FAQ\Controls\Accordion([
'max' => 50,
'stayOpen' => $Site->getAttribute('quiqqer.faq.settings.accordion.stayOpen'),
'parentSite' => $Site
]);
break;
case 'default':
default:
$offset = intval($Site->getAttribute('quiqqer.faq.settings.offset'));
$faqTemplate = 'default';
break;
}
$Engine->assign([
'entries' => $entries,
'faqTemplate' => $faqTemplate,
'offset' => $offset,
'FAQControl' => $FAQControl
]);
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren