Commit 698ba5f3 authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet
Browse files

fix: fix tests in site card

parent 8ddd8953
......@@ -7,8 +7,6 @@ import fr.inra.urgi.faidare.api.NotFoundException;
import fr.inra.urgi.faidare.config.FaidareProperties;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiAdditionalInfo;
import fr.inra.urgi.faidare.domain.data.LocationVO;
import fr.inra.urgi.faidare.domain.response.PaginatedList;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentSearchCriteria;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentVO;
import fr.inra.urgi.faidare.repository.es.LocationRepository;
import fr.inra.urgi.faidare.repository.es.XRefDocumentRepository;
......@@ -22,7 +20,7 @@ import org.springframework.web.servlet.ModelAndView;
* Controller used to display a site card based on its ID.
* @author JB Nizet
*/
@Controller
@Controller("webSiteController")
@RequestMapping("/sites")
public class SiteController {
......
......@@ -13,8 +13,7 @@ import fr.inra.urgi.faidare.domain.datadiscovery.data.DataSource;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentVO;
/**
* TODO add javadoc
*
* The model used py the site page
* @author JB Nizet
*/
public final class SiteModel {
......
......@@ -2,7 +2,6 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:biom="http://www.thymeleaf.org"
th:replace="~{layout/main :: layout(title=~{::title}, content=~{::main})}"
>
<head>
......
......@@ -2,7 +2,6 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:biom="http://www.thymeleaf.org"
th:replace="~{layout/main :: layout(title=~{::title}, content=~{::main})}"
>
<head>
......@@ -14,23 +13,26 @@
<main>
<h1>Site <th:block th:text="${model.site.locationName}" /></h1>
<div th:if="${model.site.uri && !model.site.uri.startsWith('urn:')}"
th:replace="fragments/row::text-row(label='Permanent unique identifier', text=${model.site.uri})">
</div>
<th:block th:if="${model.site.uri != null && !model.site.uri.startsWith('urn:')}">
<div th:replace="fragments/row::text-row(label='Permanent unique identifier', text=${model.site.uri})"></div>
</th:block>
<div th:if="${model.source}"
th:replace="fragments/row::row(label='Source', content=~{::#source}, text='')">
<th:block th:if="${model.source != null}">
<div th:replace="fragments/row::row(label='Source', content=~{::#source})">
<a id="source" target="_blank" th:href="${model.source.url}">
<img style="max-height: 60px;" th:src="${model.source.image}" th:alt="${model.source.name} + ' logo'" />
</a>
</div>
</th:block>
<div th:if="${model.site.url && model.source}"
th:replace="fragments/row::row(label='Data link', content=~{::#url}, text='')">
<th:block th:if="${model.site.url != null && model.source != null}">
<div
th:replace="fragments/row::row(label='Data link', content=~{::#url})">
<a id="url" target="_blank" th:href="${model.site.url}">
Link to this site on <th:block th:text="${model.source.name}" />
</a>
</div>
</th:block>
<div th:replace="fragments/row::text-row(label='Abbreviation', text=${model.site.abbreviation})"></div>
<div th:replace="fragments/row::text-row(label='Type', text=${model.site.locationType})"></div>
......@@ -38,15 +40,21 @@
<div th:replace="fragments/row::text-row(label='Institution/Landowner', text=${model.site.instituteName})"></div>
<div th:replace="fragments/row::text-row(label='Institution address', text=${model.site.instituteAddress})"></div>
<div th:replace="fragments/row::text-row(label='Coordinates precision', text=${model.coordinatesPrecision})"></div>
<div th:if="${model.site.latitude}"
th:replace="fragments/row::text-row(label='Latitude', text=${#coordinates.formatLatitude(model.site.latitude)})"></div>
<div th:if="${model.site.longitude}"
th:replace="fragments/row::text-row(label='Longitude', text=${#coordinates.formatLongitude(model.site.longitude)})"></div>
<th:block th:if="${model.site.latitude}">
<div th:replace="fragments/row::text-row(label='Latitude', text=${#coordinates.formatLatitude(model.site.latitude)})"></div>
</th:block>
<th:block th:if="${model.site.longitude}">
<div th:replace="fragments/row::text-row(label='Longitude', text=${#coordinates.formatLongitude(model.site.longitude)})"></div>
</th:block>
<div th:replace="fragments/row::text-row(label='Geographical location', text=${model.geographicalLocation})"></div>
<div th:if="${model.site.countryName && !model.geographicalLocation}"
th:replace="fragments/row::text-row(label='Country name', text=${model.site.countryName})"></div>
<div th:if="${model.site.countryCode && !model.geographicalLocation}"
th:replace="fragments/row::text-row(label='Country code', text=${model.site.countryName})"></div>
<th:block th:if="${model.site.countryName != null && model.geographicalLocation == null}">
<div th:replace="fragments/row::text-row(label='Country name', text=${model.site.countryName})"></div>
</th:block>
<th:block th:if="${model.site.countryCode != null && model.geographicalLocation == null}">
<div th:replace="fragments/row::text-row(label='Country code', text=${model.site.countryName})"></div>
</th:block>
<div th:replace="fragments/row::text-row(label='Altitude', text=${model.site.altitude})"></div>
<div th:replace="fragments/row::text-row(label='Slope', text=${model.slope})"></div>
<div th:replace="fragments/row::text-row(label='Exposure', text=${model.exposure})"></div>
......@@ -56,7 +64,7 @@
<div th:replace="fragments/row::text-row(label='Direction from city', text=${model.directionFromCity})"></div>
<div th:replace="fragments/row::text-row(label='Comment', text=${model.comment})"></div>
<th:block th:if="${!#lists.isEmpty(model.additionalInfoProperties)}">
<th:block th:unless="${#lists.isEmpty(model.additionalInfoProperties)}">
<h2>Additional info</h2>
<th:block th:each="prop : ${model.additionalInfoProperties}">
<div th:replace="fragments/row::text-row(label=${prop.key}, text=${prop.value})"></div>
......
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