Commit 4811cb80 authored by Matija Obreza's avatar Matija Obreza

Multiple "crops" possible

parent 407737ee
......@@ -32,8 +32,8 @@ public interface CropTaxonomyRepository extends JpaRepository<CropTaxonomy, Long
@Query("select distinct t from CropTaxonomy ct inner join ct.taxonomy t where ct.crop = ?1")
List<Taxonomy> findTaxonomiesByCrop(Crop crop);
@Query("select ct.crop from CropTaxonomy ct where ct.taxonomy= ?1 and ct.crop.language = ?2")
Crop findByTaxonomyAndLanguage(Taxonomy taxonomy, String language);
@Query("select distinct ct.crop from CropTaxonomy ct where ct.taxonomy= ?1 and ct.crop.language = ?2")
List<Crop> findByTaxonomyAndLanguage(Taxonomy taxonomy, String language);
@Modifying
@Query("delete from CropTaxonomy ct where ct.crop = ?1")
......
......@@ -30,7 +30,7 @@ public interface CropService {
List<Crop> list(Locale locale);
Crop getCrop(Locale locale, Taxonomy taxonomy);
List<Crop> getCrop(Locale locale, Taxonomy taxonomy);
void rebuildTaxonomies();
......
......@@ -68,7 +68,7 @@ public class CropServiceImpl implements CropService {
}
@Override
public Crop getCrop(Locale locale, Taxonomy taxonomy) {
public List<Crop> getCrop(Locale locale, Taxonomy taxonomy) {
return cropTaxonomyRepository.findByTaxonomyAndLanguage(taxonomy, locale.getLanguage());
}
......
......@@ -14,8 +14,8 @@
<div class="page-header acn">
<div class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}">
<a class="add" href="<c:url value="/sel/add/${accession.id}" />"><spring:message code="selection.add" arguments="${accession.accessionName}" /></a>
<a class="remove" href="<c:url value="/sel/remove/${accession.id}" />"><spring:message code="selection.remove" arguments="${accession.accessionName}" /></a>
<a class="add" href="<c:url value="/sel/add/${accession.id}" />"><spring:message code="selection.add" arguments="${accession.accessionName}" /></a> <a class="remove" href="<c:url value="/sel/remove/${accession.id}" />"><spring:message code="selection.remove"
arguments="${accession.accessionName}" /></a>
</div>
</div>
......@@ -58,7 +58,9 @@
<c:if test="${crop ne null}">
<tr>
<td><spring:message code="accession.crop" /></td>
<td><a href="<c:url value="/c/${crop.shortName}" />"><c:out value="${crop.name}" /></a></td>
<td><c:forEach items="${crop}" var="c">
<a href="<c:url value="/c/${c.shortName}" />"><c:out value="${c.name}" /></a>
</c:forEach></td>
</tr>
</c:if>
......@@ -80,8 +82,8 @@
</tr>
<tr>
<td><spring:message code="taxonomy.taxonName" /></td>
<td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a> <br />
<a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><spring:message code="accession.taxonomy-at-institute" arguments="${accession.taxonomy.taxonName}|||${accession.institute.code}" argumentSeparator="|||" /></a></td>
<td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a> <br /> <a
href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><spring:message code="accession.taxonomy-at-institute" arguments="${accession.taxonomy.taxonName}|||${accession.institute.code}" argumentSeparator="|||" /></a></td>
</tr>
<tr>
<td><spring:message code="accession.otherNames" /></td>
......@@ -142,11 +144,38 @@
</tr>
</c:if>
<c:if test="${accession.svalbardData ne null}">
<tr>
<td colspan="2">
<h4>Svalbard data</h4>
</td>
</tr>
<tr>
<td>Reported taxonomy</td>
<td>${accession.svalbardData.taxonomy}</td>
</tr>
<tr>
<td>Deposit date</td>
<td>${accession.svalbardData.depositDate}</td>
</tr>
<tr>
<td>Box number</td>
<td>${accession.svalbardData.boxNumber}</td>
</tr>
<tr>
<td>Quantity</td>
<td>${accession.svalbardData.quantity}</td>
</tr>
</c:if>
</tbody>
</table>
<c:if test="${methods.size() gt 0}">
<h2>
<spring:message code="accession.methods" />
......@@ -174,13 +203,19 @@
<spring:message code="accession.metadatas" />
</h3>
<ul class="funny-list">
<c:forEach items="${metadatas}" var="metadata" varStatus="status">
<li class="clearfix targeted ${status.count % 2 == 0 ? 'even' : 'odd'}" id="metadata-${metadata.id}">
<div class="show pull-left"><sup><c:out value="${metadata.id}" /></sup> <a href="<c:url value="/data/view/${metadata.id}" />"><c:out value="${metadata.title}" /></a></div>
<div class="pull-right"><c:out value="${metadata.institute}" /></div>
<div class="pull-right"><c:out value="${metadata.description}" /></div>
</li>
</c:forEach>
<c:forEach items="${metadatas}" var="metadata" varStatus="status">
<li class="clearfix targeted ${status.count % 2 == 0 ? 'even' : 'odd'}" id="metadata-${metadata.id}">
<div class="show pull-left">
<sup><c:out value="${metadata.id}" /></sup> <a href="<c:url value="/data/view/${metadata.id}" />"><c:out value="${metadata.title}" /></a>
</div>
<div class="pull-right">
<c:out value="${metadata.institute}" />
</div>
<div class="pull-right">
<c:out value="${metadata.description}" />
</div>
</li>
</c:forEach>
</ul>
</c:if>
......
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