From ec663cf86075fdcf8bc2f3f0c537316b577b8198 Mon Sep 17 00:00:00 2001 From: Michael Kessler <michael.kessler@sgalinski.de> Date: Wed, 30 Mar 2022 14:36:11 +0200 Subject: [PATCH] [FEATURE] Add grid column setting for news overview --- Configuration/FlexForms/Overview.xml | 28 +++++++++++++++++++ .../Private/Language/de.locallang_db.xlf | 20 +++++++++++++ Resources/Private/Language/locallang_db.xlf | 15 ++++++++++ .../Private/Templates/Overview/Overview.html | 4 +-- .../Overview/OverviewWithoutCategories.html | 2 +- 5 files changed, 66 insertions(+), 3 deletions(-) diff --git a/Configuration/FlexForms/Overview.xml b/Configuration/FlexForms/Overview.xml index 6ce2261..279dd4b 100644 --- a/Configuration/FlexForms/Overview.xml +++ b/Configuration/FlexForms/Overview.xml @@ -233,6 +233,34 @@ </config> </TCEforms> </settings.layout> + <settings.gridColumns> + <TCEforms> + <label>LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.gridColumns</label> + <config> + <type>select</type> + <renderType>selectSingle</renderType> + <default>col-md-4 col-sm-6 col-xs-12</default> + <items> + <numIndex index="0"> + <numIndex index="0">LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.gridColumns.1</numIndex> + <numIndex index="1">col-xs-12</numIndex> + </numIndex> + <numIndex index="1"> + <numIndex index="0">LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.gridColumns.2</numIndex> + <numIndex index="1">col-sm-6 col-xs-12</numIndex> + </numIndex> + <numIndex index="2"> + <numIndex index="0">LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.gridColumns.3</numIndex> + <numIndex index="1">col-md-4 col-sm-6 col-xs-12</numIndex> + </numIndex> + <numIndex index="3"> + <numIndex index="0">LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:plugin.flexForm.gridColumns.4</numIndex> + <numIndex index="1">col-lg-3 col-md-4 col-sm-6 col-xs-12</numIndex> + </numIndex> + </items> + </config> + </TCEforms> + </settings.gridColumns> </el> </ROOT> </main> diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 249b0d9..24ab0a7 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -113,6 +113,26 @@ <source><![CDATA[News which are excluded from the list]]></source> <target><![CDATA[News, welche nicht in der Liste dargestellt werden]]></target> </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns" approved="yes"> + <source><![CDATA[Columns]]></source> + <target><![CDATA[Spalten]]></target> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.1" approved="yes"> + <source><![CDATA[1 Column]]></source> + <target><![CDATA[1 Spalte]]></target> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.2" approved="yes"> + <source><![CDATA[2 Columns]]></source> + <target><![CDATA[2 Spalten]]></target> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.3" approved="yes"> + <source><![CDATA[3 Columns]]></source> + <target><![CDATA[3 Spalten]]></target> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.4" approved="yes"> + <source><![CDATA[4 Columns]]></source> + <target><![CDATA[4 Spalten]]></target> + </trans-unit> <trans-unit id="plugin.flexForm.layout" approved="yes"> <source><![CDATA[Layout]]></source> <target><![CDATA[Layout]]></target> diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index a1abc3a..4d42520 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -87,6 +87,21 @@ <trans-unit id="plugin.flexForm.excludedNews"> <source><![CDATA[News which are excluded from the list]]></source> </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns"> + <source><![CDATA[Columns]]></source> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.1"> + <source><![CDATA[1 Column]]></source> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.2"> + <source><![CDATA[2 Columns]]></source> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.3"> + <source><![CDATA[3 Columns]]></source> + </trans-unit> + <trans-unit id="plugin.flexForm.gridColumns.4"> + <source><![CDATA[4 Columns]]></source> + </trans-unit> <trans-unit id="plugin.flexForm.layout"> <source><![CDATA[Layout]]></source> </trans-unit> diff --git a/Resources/Private/Templates/Overview/Overview.html b/Resources/Private/Templates/Overview/Overview.html index 6cc96d8..69e998f 100644 --- a/Resources/Private/Templates/Overview/Overview.html +++ b/Resources/Private/Templates/Overview/Overview.html @@ -58,7 +58,7 @@ <ul class="tx-sgnews-list tx-sgnews-list-{dataItems.record.uid} row" data-record="{dataItems.record.uid}"> <f:for each="{dataItems.newsMetaData}" as="newsMetaDataEntry"> <f:if condition="{newsMetaDataEntry.news}"> - <li class="col-md-4 col-sm-6 col-xs-12"> + <li class="{f:if(condition: '{settings.gridColumns}', then: '{settings.gridColumns}', else: 'col-md-4 col-sm-6 col-xs-12')}"> <f:render partial="Teaser" arguments="{ newsMetaData: newsMetaDataEntry, headerTag: '<h2>', @@ -92,7 +92,7 @@ <f:section name="content"> <ul class="tx-sgnews-list tx-sgnews-list-0 row" data-record="0"> <f:for each="{allNews}" as="newsMetaDataEntry"> - <li class="col-md-4 col-sm-6 col-xs-12"> + <li class="{f:if(condition: '{settings.gridColumns}', then: '{settings.gridColumns}', else: 'col-md-4 col-sm-6 col-xs-12')}"> <f:render partial="Teaser" arguments="{ newsMetaData: newsMetaDataEntry, headerTag: '<h2>', diff --git a/Resources/Private/Templates/Overview/OverviewWithoutCategories.html b/Resources/Private/Templates/Overview/OverviewWithoutCategories.html index e41b2fc..9402555 100644 --- a/Resources/Private/Templates/Overview/OverviewWithoutCategories.html +++ b/Resources/Private/Templates/Overview/OverviewWithoutCategories.html @@ -18,7 +18,7 @@ <f:then> <ul class="tx-sgnews-list tx-sgnews-list-0 row" data-record="0"> <f:for each="{newsMetaData}" as="newsMetaDataEntry"> - <li class="col-md-4 col-sm-6 col-xs-12"> + <li class="{f:if(condition: '{settings.gridColumns}', then: '{settings.gridColumns}', else: 'col-md-4 col-sm-6 col-xs-12')}"> <f:render partial="Teaser" arguments="{ newsMetaData: newsMetaDataEntry, headerTag: '<h2>', -- GitLab