Commit 4daab86b authored by Matija Obreza's avatar Matija Obreza

Allow for browsing per genus

parent a830f2ff
......@@ -165,6 +165,27 @@ public class WiewsController extends BaseController {
return "redirect:/explore";
}
@RequestMapping("/{wiewsCode}/t/{genus}")
public String viewDataByGenusSpecies(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @PathVariable(value = "genus") String genus,
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
_logger.debug("Viewing country " + wiewsCode);
FaoInstitute faoInstitute = instituteService.getInstitute(wiewsCode);
if (faoInstitute == null) {
throw new ResourceNotFoundException();
}
// Taxonomy
Taxonomy2 taxonomy2 = taxonomyService.get(genus);
if (taxonomy2 == null) {
throw new ResourceNotFoundException();
}
_logger.debug("Got " + taxonomy2);
model.addAttribute("filter", "{\"instCode\":[\"" + faoInstitute.getCode() + "\"],\"genus\":[\"" + taxonomy2.getGenus() + "\"]}");
model.addAttribute("page", page);
return "redirect:/explore";
}
@RequestMapping("/{wiewsCode}/t/{genus}/{species:.+}")
public String viewDataByGenusSpecies(ModelMap model, @PathVariable(value = "wiewsCode") String wiewsCode, @PathVariable(value = "genus") String genus,
@PathVariable(value = "species") String species, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
......
......@@ -113,7 +113,7 @@
<tr>
<td><spring:message code="taxonomy.genus" /></td>
<td property="dwc:genus"><c:out value="${accession.taxonomy.genus}" /></td>
<td property="dwc:genus"><a href="<c:url value="/acn/t/${accession.taxonomy.genus}" />"><c:out value="${accession.taxonomy.genus}" /></a></td>
</tr>
<tr>
<td><spring:message code="taxonomy.species" /></td>
......
......@@ -129,7 +129,7 @@
<h4><spring:message code="faoInstitute.stat-by-genus" arguments="${statisticsGenus.numberOfElements}" /></h4>
<ul class="funny-list statistics">
<c:forEach items="${statisticsGenus.content}" var="stat" varStatus="status">
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}"><span class="stats-number"><fmt:formatNumber value="${stat[1]}" /></span> <c:out value="${stat[0]}" /></li>
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}"><span class="stats-number"><fmt:formatNumber value="${stat[1]}" /></span> <a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}/t/${stat[0]}" />"><c:out value="${stat[0]}" /></a></li>
</c:forEach>
</ul>
</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