Commit 654e37ed authored by Thomas Löffler's avatar Thomas Löffler

Add a document wrap for better difference between exact match and result

parent 9e98edbe
Pipeline #4559 passed with stages
in 5 minutes and 47 seconds
......@@ -2,62 +2,80 @@
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers">
<f:section name="Document">
<{f:if(condition:exactMatch, then: 'div', else: 'li')} class="card card-size-medium mb-3{f:if(condition:exactMatch, then: ' border-primary bg-light')}"
data-document-score="{document.score}"
data-document-id="{document.id}"
data-document-url="{document.url}"
>
<f:if condition="{document.isElevated}">
<div class="results-elevated-label">
<s:translate key="sponsored" />
</div>
</f:if>
<div class="card-body">
<div class="align-items-center">
<h3 class="card-title">
<f:if condition="{document.extensionIcon_stringS}">
<img class="ter-ext-icon" alt="{document.title}" src="{document.extensionIcon_stringS}" height="32" width="32">
</f:if>
<a href="{s:uri.result.addSearchWordList(url:document.url, searchWords:resultSet.usedQuery.keywords)}">{document.title}</a>
</h3>
<h4 class="card-subtitle text-muted mb-2">
{document.extensionKey_stringS} /
<span class="ter-ext-state ter-ext-state-{document.extensionState_stringS}">{document.extensionState_stringS}</span>
</h4>
<p>
<small>
<f:format.crop maxCharacters="{f:if(condition:exactMatch, then: '360', else: '180')}" respectWordBoundaries="true">{s:document.highlightResult(resultSet:resultSet, document:document, fieldName:'content')}</f:format.crop>
<br>
<em>
Uploaded on
<f:format.date format="d M Y">@{document.extensionLastUpload_intS}</f:format.date>
<f:if condition="{document.author}">
by
<f:format.crop maxCharacters="{f:if(condition:exactMatch, then: '100', else: '50')}">{document.author}</f:format.crop>
</f:if>
</em>
</small>
</p>
<ul class="list-inline">
<f:if condition="{document.supports7_boolS}">
<li class="list-inline-item badge badge-success">7 LTS</li>
</f:if>
<f:if condition="{document.supports8_boolS}">
<li class="list-inline-item badge badge-success">8 LTS</li>
</f:if>
<f:if condition="{document.hasManual_boolS}">
<li class="list-inline-item badge badge-info"><i class="fa fa-book"></i> Has manual</li>
</f:if>
</ul>
<f:section name="DocumentWrap">
<f:if condition="{exactMatchFound}">
<f:then>
<div class="card card-size-medium mb-3 border-primary bg-light"
data-document-score="{document.score}"
data-document-id="{document.id}"
data-document-url="{document.url}"
>
<f:render section="Document" arguments="{_all}" />
</div>
</f:then>
<f:else>
<li class="card card-size-medium mb-3"
data-document-score="{document.score}"
data-document-id="{document.id}"
data-document-url="{document.url}"
>
<f:render section="Document" arguments="{_all}" />
</li>
</f:else>
</f:if>
</f:section>
<f:section name="Document">
<f:if condition="{document.isElevated}">
<div class="results-elevated-label">
<s:translate key="sponsored" />
</div>
</f:if>
<div class="card-body">
<div class="align-items-center">
<h3 class="card-title">
<f:if condition="{document.extensionIcon_stringS}">
<img class="ter-ext-icon" alt="{document.title}" src="{document.extensionIcon_stringS}" height="32" width="32">
</f:if>
<a href="{s:uri.result.addSearchWordList(url:document.url, searchWords:resultSet.usedQuery.keywords)}">{document.title}</a>
</h3>
<h4 class="card-subtitle text-muted mb-2">
{document.extensionKey_stringS} /
<span class="ter-ext-state ter-ext-state-{document.extensionState_stringS}">{document.extensionState_stringS}</span>
</h4>
<p>
<small>
<f:format.crop maxCharacters="{f:if(condition:exactMatchFound, then: '360', else: '180')}" respectWordBoundaries="true">{s:document.highlightResult(resultSet:resultSet, document:document, fieldName:'content')}</f:format.crop>
<br>
<em>
Uploaded on
<f:format.date format="d M Y">@{document.extensionLastUpload_intS}</f:format.date>
<f:if condition="{document.author}">
by
<f:format.crop maxCharacters="{f:if(condition:exactMatchFound, then: '100', else: '50')}">{document.author}</f:format.crop>
</f:if>
</em>
</small>
</p>
<ul class="list-inline">
<f:if condition="{document.supports7_boolS}">
<li class="list-inline-item badge badge-success">7 LTS</li>
</f:if>
<f:if condition="{document.supports8_boolS}">
<li class="list-inline-item badge badge-success">8 LTS</li>
</f:if>
<f:if condition="{document.hasManual_boolS}">
<li class="list-inline-item badge badge-info"><i class="fa fa-book"></i> Has manual</li>
</f:if>
</ul>
</div>
<f:if condition="{document.insecure_boolS}">
<f:else>
<a class="btn {f:if(condition:exactMatch, then: 'btn-primary', else: 'btn-outline-primary')} btn-block mb-0" href="{document.extensionDownloadZipUrl_stringS}">
<i class="fa fa-download"></i> Download version {document.extensionVersion_stringS} as ZIP
</a>
</f:else>
</f:if>
</{f:if(condition:exactMatch, then: 'div', else: 'li')}>
</div>
<f:if condition="{document.insecure_boolS}">
<f:else>
<a class="btn {f:if(condition:exactMatchFound, then: 'btn-primary', else: 'btn-outline-primary')} btn-block mb-0" href="{document.extensionDownloadZipUrl_stringS}">
<i class="fa fa-download"></i> Download version {document.extensionVersion_stringS} as ZIP
</a>
</f:else>
</f:if>
</f:section>
......@@ -45,14 +45,14 @@
<s:widget.resultPaginate resultSet="{resultSet}" configuration="{templatePath:'EXT:ter_layout/Resources/Private/Templates/Solr/ViewHelpers/Widget/ResultPaginate/Index.html'}">
<f:variable name="exactMatchFound" value="0" />
<f:if condition="{resultSet.usedQuery.queryString -> f:format.case(mode:'lower')} == {documents.0.extensionKey_stringS}">
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:documents.0, exactMatch: 1}" />
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:documents.0, exactMatchFound: 1}" />
<f:variable name="exactMatchFound" value="1" />
</f:if>
<ol start="{pagination.displayRangeStart}" class="results-list list-unstyled card-container">
<f:for each="{documents}" as="document" iteration="iterator">
<f:if condition="{exactMatchFound} && {iterator.isFirst}">
<f:else>
<f:render partial="Result/Document" section="Document" arguments="{resultSet:resultSet, document:document}" />
<f:render partial="Result/Document" section="DocumentWrap" arguments="{resultSet:resultSet, document:document}" />
</f:else>
</f:if>
</f:for>
......
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