Skip to content
Snippets Groups Projects
Verified Commit 7799915b authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Style the related news teasers

parent 03180d0f
No related branches found
No related tags found
1 merge request!44[BUGFIX] Fix bugs with fetching the related news
...@@ -545,7 +545,7 @@ class NewsRepository extends AbstractRepository { ...@@ -545,7 +545,7 @@ class NewsRepository extends AbstractRepository {
->from('pages', 'pages') ->from('pages', 'pages')
->where( ->where(
$qb->expr()->eq('doktype', $qb->createNamedParameter(News::DOK_TYPE_NEWS, Connection::PARAM_INT)), $qb->expr()->eq('doktype', $qb->createNamedParameter(News::DOK_TYPE_NEWS, Connection::PARAM_INT)),
$qb->expr()->gt('lastUpdated', $news->getLastUpdated()->getTimestamp()) $qb->expr()->gte('lastUpdated', $news->getLastUpdated()->getTimestamp())
)->andWhere(...$constraints) )->andWhere(...$constraints)
->orderBy('lastUpdated', 'desc') ->orderBy('lastUpdated', 'desc')
->execute(); ->execute();
...@@ -554,7 +554,7 @@ class NewsRepository extends AbstractRepository { ...@@ -554,7 +554,7 @@ class NewsRepository extends AbstractRepository {
// Here we fetch the lastUpdated of the $limit amount of news with older lastUpdated dates // Here we fetch the lastUpdated of the $limit amount of news with older lastUpdated dates
$result = $qb->where( $result = $qb->where(
$qb->expr()->eq('doktype', $qb->createNamedParameter(News::DOK_TYPE_NEWS, Connection::PARAM_INT)), $qb->expr()->eq('doktype', $qb->createNamedParameter(News::DOK_TYPE_NEWS, Connection::PARAM_INT)),
$qb->expr()->lt('lastUpdated', $news->getLastUpdated()->getTimestamp()) $qb->expr()->lte('lastUpdated', $news->getLastUpdated()->getTimestamp())
)->andWhere(...$constraints) )->andWhere(...$constraints)
->orderBy('lastUpdated', 'asc') ->orderBy('lastUpdated', 'asc')
->execute(); ->execute();
......
...@@ -57,7 +57,7 @@ class RelatedViewHelper extends AbstractViewHelper { ...@@ -57,7 +57,7 @@ class RelatedViewHelper extends AbstractViewHelper {
$iterationData = [ $iterationData = [
'index' => 0, 'index' => 0,
'cycle' => 1, 'cycle' => 1,
'total' => count($arguments['each']) 'total' => count($related)
]; ];
} }
......
{namespace sg=SGalinski\SgNews\ViewHelpers}
<f:comment>
<!--
Usage Example:
<f:render partial="Teaser" arguments="{
newsMetaData: newsMetaData,
headerTag: '<h3>',
closingHeaderTag: '</h3>',
showCategory: 1
}" />
newsMetaData -> news element
headerTag -> hierarchy type of the header tag
showCategory -> defines if the category may be shown
Use <f:debug>{_all}</f:debug> to see all parameters and fields.
-->
</f:comment>
<f:link.page pageUid="{news.uid}" class="tx-sgnews-teaser">
<f:if condition="{news.teaser1Image}">
<f:for each="{news.teaser1Image}" as="teaserImage">
<div class="tx-sgnews-teaser-image tx-sgnews-teaser-image-stretched"
style="background-image: url({f:uri.image(image: teaserImage)});"></div>
</f:for>
</f:if>
<div class="tx-sgnews-teaser-inner">
<div class="tx-sgnews-teaser-title">
{headerTag -> f:format.raw()}
{news.subtitleWithFallbackToTitle}
{closingHeaderTag -> f:format.raw()}
</div>
</div>
</f:link.page>
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
<section class="content"> <section class="content">
<div class="container"> <div class="container">
<div class="tx-sgnews-single"> <div class="tx-sgnews-single">
<div class="tx-sgnews-single-container"> <ul class="tx-sgnews-single-container">
<f:alias <f:alias
map="{content: '{f:cObject(typoscriptObjectPath: \'{f:if(condition: \\\'{newsMetaData.news.contentFromAnotherPage}\\\', then: \\\'lib.contentFromAnotherPage\\\', else: \\\'lib.mainContent\\\')}\')}'}"> map="{content: '{f:cObject(typoscriptObjectPath: \'{f:if(condition: \\\'{newsMetaData.news.contentFromAnotherPage}\\\', then: \\\'lib.contentFromAnotherPage\\\', else: \\\'lib.mainContent\\\')}\')}'}">
<div class="tx-sgnews-single-content"> <div class="tx-sgnews-single-content">
...@@ -216,21 +216,26 @@ ...@@ -216,21 +216,26 @@
</div> </div>
</f:then> </f:then>
<f:else> <f:else>
<div class="tx-sgnews-single-related"> <sg:related news="{newsMetaData.news}" iteration="iterator" limit="5" as="relatedNewsEntry">
<h3> <f:if condition="{iterator.isFirst}">
<f:translate key="frontend.singleview.relatedArticles"/> <div class="tx-sgnews-single-related">
</h3> <h3>
<f:translate key="frontend.singleview.relatedArticles"/>
<ul> </h3>
<sg:related news="{newsMetaData.news}" limit="5" as="relatedNewsEntry"> <ul class="tx-sgnews-list tx-sgnews-overview">
<li> </f:if>
<a href="{f:uri.page(pageUid: '{relatedNewsEntry.uid}')}"> <li class="col-md-4 col-sm-6 col-xs-12">
{relatedNewsEntry.subtitleWithFallbackToTitle} <f:render partial="TeaserRelated" arguments="{
</a> news: relatedNewsEntry,
</li> headerTag: '<h2>',
</sg:related> closingHeaderTag: '</h2>'
</ul> }" />
</div> </li>
<f:if condition="{iterator.isLast}">
</ul>
</div>
</f:if>
</sg:related>
</f:else> </f:else>
</f:if> </f:if>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment