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,12 +2,31 @@
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')}"
<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" />
......@@ -27,14 +46,14 @@
</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>
<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:exactMatch, then: '100', else: '50')}">{document.author}</f:format.crop>
<f:format.crop maxCharacters="{f:if(condition:exactMatchFound, then: '100', else: '50')}">{document.author}</f:format.crop>
</f:if>
</em>
</small>
......@@ -54,10 +73,9 @@
</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}">
<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:if(condition:exactMatch, then: 'div', else: 'li')}>
</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