Commit b352a6fb authored by Matija Obreza's avatar Matija Obreza
Browse files

Use "pagedData"

parent cb418418
...@@ -95,7 +95,7 @@ public class AccessionController extends BaseController { ...@@ -95,7 +95,7 @@ public class AccessionController extends BaseController {
} }
model.addAttribute("faoInstitute", faoInstitute); model.addAttribute("faoInstitute", faoInstitute);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
return "/accession/resolve"; return "/accession/resolve";
} }
...@@ -111,7 +111,7 @@ public class AccessionController extends BaseController { ...@@ -111,7 +111,7 @@ public class AccessionController extends BaseController {
public String viewAll(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) { public String viewAll(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
Page<Accession> accessions = genesysService.listAccessions(new PageRequest(page - 1, 50, new Sort("accessionName"))); Page<Accession> accessions = genesysService.listAccessions(new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions); _logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
return "/accession/data"; return "/accession/data";
...@@ -142,7 +142,7 @@ public class AccessionController extends BaseController { ...@@ -142,7 +142,7 @@ public class AccessionController extends BaseController {
Page<Accession> accessions = genesysService.listAccessionsByTaxonomy(taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName"))); Page<Accession> accessions = genesysService.listAccessionsByTaxonomy(taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions); _logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
return "/accession/data"; return "/accession/data";
......
...@@ -86,7 +86,7 @@ public class CountryController extends BaseController { ...@@ -86,7 +86,7 @@ public class CountryController extends BaseController {
if (country==null) { if (country==null) {
throw new ResourceNotFoundException(); throw new ResourceNotFoundException();
} }
model.addAttribute("accessions", genesysService.listAccessionsByOrigin(country, new PageRequest(page - 1, 50, new Sort("accessionName")))); model.addAttribute("pagedData", genesysService.listAccessionsByOrigin(country, new PageRequest(page - 1, 50, new Sort("accessionName"))));
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
......
...@@ -89,7 +89,7 @@ public class CropController extends BaseController { ...@@ -89,7 +89,7 @@ public class CropController extends BaseController {
_logger.warn("Listing acns"); _logger.warn("Listing acns");
Page<Accession> accessions = genesysService.listAccessionsByCrop(crop, new PageRequest(page - 1, 50, new Sort("accessionName"))); Page<Accession> accessions = genesysService.listAccessionsByCrop(crop, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions); _logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
......
...@@ -66,7 +66,7 @@ public class DatasetController extends BaseController { ...@@ -66,7 +66,7 @@ public class DatasetController extends BaseController {
model.addAttribute("methods", genesysService.listMethods(metadata)); model.addAttribute("methods", genesysService.listMethods(metadata));
Page<Accession> accessions = genesysService.listMetadataAccessions(metadata, new PageRequest(page - 1, 50)); Page<Accession> accessions = genesysService.listMetadataAccessions(metadata, new PageRequest(page - 1, 50));
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
// Map[accession.id][method.id] // Map[accession.id][method.id]
model.addAttribute("accessionMethods", genesysService.getMetadataTraitValues(metadata, accessions.getContent())); model.addAttribute("accessionMethods", genesysService.getMetadataTraitValues(metadata, accessions.getContent()));
......
...@@ -46,7 +46,7 @@ public class SelectionController extends BaseController { ...@@ -46,7 +46,7 @@ public class SelectionController extends BaseController {
@RequestMapping @RequestMapping
public String view(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) { public String view(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("accessions", genesysService.listAccessions(selectionBean.copy(), new PageRequest(page - 1, 50, new Sort("accessionName")))); model.addAttribute("pagedData", genesysService.listAccessions(selectionBean.copy(), new PageRequest(page - 1, 50, new Sort("accessionName"))));
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
......
...@@ -56,14 +56,14 @@ public class WiewsController extends BaseController { ...@@ -56,14 +56,14 @@ public class WiewsController extends BaseController {
@RequestMapping("/") @RequestMapping("/")
public String view(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) { public String view(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("faoInstitutes", instituteService.list(new PageRequest(page - 1, 50, new Sort("code")))); model.addAttribute("pagedData", instituteService.list(new PageRequest(page - 1, 50, new Sort("code"))));
return "/wiews/index"; return "/wiews/index";
} }
@RequestMapping("/active") @RequestMapping("/active")
public String viewGenesys(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) { public String viewGenesys(ModelMap model, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
model.addAttribute("activeOnly", true); model.addAttribute("activeOnly", true);
model.addAttribute("faoInstitutes", instituteService.listActive(new PageRequest(page - 1, 50, new Sort("code")))); model.addAttribute("pagedData", instituteService.listActive(new PageRequest(page - 1, 50, new Sort("code"))));
return "/wiews/index"; return "/wiews/index";
} }
...@@ -95,7 +95,7 @@ public class WiewsController extends BaseController { ...@@ -95,7 +95,7 @@ public class WiewsController extends BaseController {
_logger.warn("Searching accessions of: " + faoInstitute); _logger.warn("Searching accessions of: " + faoInstitute);
Page<Accession> accessions = genesysService.listAccessionsByInstitute(faoInstitute, new PageRequest(page - 1, 50, new Sort("accessionName"))); Page<Accession> accessions = genesysService.listAccessionsByInstitute(faoInstitute, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions); _logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
HashMap<Object, Object> filters = new HashMap<Object, Object>(); HashMap<Object, Object> filters = new HashMap<Object, Object>();
...@@ -123,7 +123,7 @@ public class WiewsController extends BaseController { ...@@ -123,7 +123,7 @@ public class WiewsController extends BaseController {
_logger.warn("Searching accessions of: " + faoInstitute); _logger.warn("Searching accessions of: " + faoInstitute);
Page<Accession> accessions = genesysService.listAccessionsByInstituteAndTaxonomy(faoInstitute, taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName"))); Page<Accession> accessions = genesysService.listAccessionsByInstituteAndTaxonomy(faoInstitute, taxonomy, new PageRequest(page - 1, 50, new Sort("accessionName")));
_logger.info("Got: " + accessions); _logger.info("Got: " + accessions);
model.addAttribute("accessions", accessions); model.addAttribute("pagedData", accessions);
model.addAttribute("selection", selectionBean); model.addAttribute("selection", selectionBean);
......
...@@ -45,11 +45,11 @@ ...@@ -45,11 +45,11 @@
<div class="nav-header"> <div class="nav-header">
<spring:message code="accessions.number" arguments="${accessions.totalElements}" /> <spring:message code="accessions.number" arguments="${pagedData.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${accessions.number+1},${accessions.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a href="?page=${accessions.number}">⇇ Previous</a> <a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a>
<a href="?page=${accessions.number + 2}">Next ⇉</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div> </div>
<table class="accessions"> <table class="accessions">
...@@ -60,32 +60,29 @@ ...@@ -60,32 +60,29 @@
<td /> <td />
</c:if> </c:if>
<td><spring:message code="accession.accessionName" /></td> <td><spring:message code="accession.accessionName" /></td>
<td><spring:message code="accession.origin" /></td>
<td><spring:message code="accession.taxonomy" /></td> <td><spring:message code="accession.taxonomy" /></td>
<td><spring:message code="accession.origin" /></td>
<td><spring:message code="accession.holdingInstitute" /></td> <td><spring:message code="accession.holdingInstitute" /></td>
<td><spring:message code="accession.holdingCountry" /></td> <%-- <td><spring:message code="accession.holdingCountry" /></td>
</tr> --%> </tr>
</thead> </thead>
<tbody> <tbody>
<c:forEach items="${accessions.content}" var="accession" varStatus="status"> <c:forEach items="${pagedData.content}" var="accession" varStatus="status">
<tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}"> <tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td> <td class="idx-col">${status.count + pagedData.size * pagedData.number}</td>
<c:if test="${selection ne null}"> <c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td> <td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if> </c:if>
<td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td> <td><a href="<c:url value="/acn/id/${accession.id}" />"><b><c:out value="${accession.accessionName}" /></b></a></td>
<td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td>
<td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a></td> <td><a href="<c:url value="/acn/t/${accession.taxonomy.genus}/${accession.taxonomy.species}" />"><c:out value="${accession.taxonomy.taxonName}" /></a></td>
<td><a href="<c:url value="/geo/${accession.origin.toLowerCase()}" />"><c:out value="${accession.countryOfOrigin.name}" /></a></td>
<td><a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}" />"><c:out value="${accession.institute.code}" /></a></td> <td><a href="<c:url value="/wiews/${accession.institute.code.toLowerCase()}" />"><c:out value="${accession.institute.code}" /></a></td>
<td><a href="<c:url value="/geo/${accession.institute.country.code3.toLowerCase()}" />"><c:out value="${accession.institute.country.name}" /></a></td> <%-- <td><a href="<c:url value="/geo/${accession.institute.country.code3.toLowerCase()}" />"><c:out value="${accession.institute.country.name}" /></a></td>
</tr> --%> </tr>
</c:forEach> </c:forEach>
</tbody> </tbody>
</table> </table>
<div class="nav-header">
<a href="?page=${accessions.number}">⇇ Previous</a> <a href="?page=${accessions.number + 2}">Next ⇉</a>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<spring:message code="paged.totalElements" arguments="${traits.totalElements}" /> <spring:message code="paged.totalElements" arguments="${traits.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${traits.number+1},${traits.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${traits.number+1},${traits.totalPages}" />
<a href="?page=${traits.number}">⇇ Previous</a> <a href="?page=${traits.number + 2}">Next ⇉</a> <a class="${traits.number eq 0 ? 'disabled' :''}" href="?page=${traits.number eq 0 ? 1 : traits.number}">⇇ Previous</a> <a href="?page=${traits.number + 2}">Next ⇉</a>
</div> </div>
<table class="accessions"> <table class="accessions">
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<spring:message code="paged.totalElements" arguments="${metadatas.totalElements}" /> <spring:message code="paged.totalElements" arguments="${metadatas.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${metadatas.number+1},${metadatas.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${metadatas.number+1},${metadatas.totalPages}" />
<a href="?page=${metadatas.number}">⇇ Previous</a> <a href="?page=${metadatas.number + 2}">Next ⇉</a> <a class="${metadatas.number eq 0 ? 'disabled' :''}" href="?page=${metadatas.number eq 0 ? 1 : metadatas.number}">⇇ Previous</a> <a href="?page=${metadatas.number + 2}">Next ⇉</a>
</div> </div>
<ul class="funny-list"> <ul class="funny-list">
<c:forEach items="${metadatas.content}" var="metadata" varStatus="status"> <c:forEach items="${metadatas.content}" var="metadata" varStatus="status">
......
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
</c:if> </c:if>
<div class="nav-header"> <div class="nav-header">
<spring:message code="paged.totalElements" arguments="${accessions.totalElements}" /> <spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${accessions.number+1},${accessions.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a href="?page=${accessions.number}">⇇ Previous</a> <a href="?page=${accessions.number + 2}">Next ⇉</a> <a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div> </div>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<tbody> <tbody>
<c:forEach items="${accessions.content}" var="accession" varStatus="status"> <c:forEach items="${accessions.content}" var="accession" varStatus="status">
<tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}"> <tr class="acn ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td> <td class="idx-col">${status.count + pagedData.size * pagedData.number}</td>
<c:if test="${selection ne null}"> <c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td> <td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if> </c:if>
......
...@@ -11,19 +11,19 @@ ...@@ -11,19 +11,19 @@
<spring:message code="selection.page.title" /> <spring:message code="selection.page.title" />
</h1> </h1>
<c:if test="${accessions == null}"> <c:if test="${pagedData == null}">
<div class="alert"> <div class="alert">
<spring:message code="selection.empty-list-warning" /> <spring:message code="selection.empty-list-warning" />
</div> </div>
</c:if> </c:if>
<c:if test="${accessions != null}"> <c:if test="${pagedData != null}">
<div class="nav-header"> <div class="nav-header">
<spring:message code="accessions.number" arguments="${accessions.totalElements}" /> <spring:message code="accessions.number" arguments="${pagedData.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${accessions.number+1},${accessions.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a href="?page=${accessions.number}">⇇ Previous</a> <a href="?page=${accessions.number + 2}">Next ⇉</a> <a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div> </div>
<table class="accessions"> <table class="accessions">
...@@ -42,9 +42,9 @@ ...@@ -42,9 +42,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<c:forEach items="${accessions.content}" var="accession" varStatus="status"> <c:forEach items="${pagedData.content}" var="accession" varStatus="status">
<tr id="a${accession.id}" class="acn targeted ${status.count % 2 == 0 ? 'even' : 'odd'}"> <tr id="a${accession.id}" class="acn targeted ${status.count % 2 == 0 ? 'even' : 'odd'}">
<td class="idx-col">${status.count + accessions.size * accessions.number}</td> <td class="idx-col">${status.count + pagedData.size * pagedData.number}</td>
<c:if test="${selection ne null}"> <c:if test="${selection ne null}">
<td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td> <td class="sel ${selection.containsId(accession.id) ? 'picked' : ''}" x-aid="${accession.id}"></td>
</c:if> </c:if>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</c:if> </c:if>
<c:if test="${accessions eq null or accessions.number eq 0}"> <c:if test="${pagedData eq null or pagedData.number eq 0}">
<h4 style="margin-top: 3em">Add multiple accessions</h4> <h4 style="margin-top: 3em">Add multiple accessions</h4>
<form method="post" action="<c:url value="/sel/add-many" />" class="form-horizontal"> <form method="post" action="<c:url value="/sel/add-many" />" class="form-horizontal">
<div class="control-group"> <div class="control-group">
......
...@@ -19,21 +19,20 @@ ...@@ -19,21 +19,20 @@
</c:if> </c:if>
<div class="nav-header"> <div class="nav-header">
<spring:message code="paged.totalElements" arguments="${faoInstitutes.totalElements}" /> <spring:message code="paged.totalElements" arguments="${pagedData.totalElements}" />
<br /> <br />
<spring:message code="paged.pageOfPages" arguments="${faoInstitutes.number+1},${faoInstitutes.totalPages}" /> <spring:message code="paged.pageOfPages" arguments="${pagedData.number+1},${pagedData.totalPages}" />
<a href="?page=${faoInstitutes.number}">⇇ Previous</a> <a class="${pagedData.number eq 0 ? 'disabled' :''}" href="?page=${pagedData.number eq 0 ? 1 : pagedData.number}">⇇ Previous</a>
<a href="?page=${faoInstitutes.number + 2}">Next ⇉</a> <a href="?page=${pagedData.number + 2}">Next ⇉</a>
</div> </div>
<ul class="funny-list"> <ul class="funny-list">
<c:forEach items="${faoInstitutes.content}" var="faoInstitute" varStatus="status"> <c:forEach items="${pagedData.content}" var="faoInstitute" varStatus="status">
<li><a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a> <li><a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a>
<spring:message code="faoInstitute.accessionCount" arguments="${faoInstitute.accessionCount}" /> <spring:message code="faoInstitute.accessionCount" arguments="${faoInstitute.accessionCount}" />
</li> </li>
</c:forEach> </c:forEach>
</ul> </ul>
<div class="nav-header"><a href="?page=${faoInstitutes.number}">⇇ Previous</a> <a href="?page=${faoInstitutes.number + 2}">Next ⇉</a></div>
</body> </body>
</html> </html>
\ No newline at end of file
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