Commit 01942161 authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

#275 Extend Recent activity 2

parent 5891e64a
......@@ -67,4 +67,12 @@ public interface DatasetRepository extends JpaRepository<Dataset, Long>, QueryDs
*/
@Query("select distinct d from Dataset d where d.id in :ids")
List<Dataset> loadListByIds(@Param("ids") List<Long> ids);
/**
* Load data about last published datasets.
*
* @return the data about last published datasets
*/
@Query("select year(d.lastModifiedDate), month(d.lastModifiedDate), day(d.lastModifiedDate), d.title, d.uuid, d.owner.shortName from Dataset d where d.published = true order by year(d.lastModifiedDate) desc, month(d.lastModifiedDate) desc, day(d.lastModifiedDate) desc")
List<Object[]> lastPublished();
}
......@@ -232,4 +232,11 @@ public interface DatasetService {
*/
long countPublished();
/**
* Load data about last published datasets.
*
* @return the data about last published datasets
*/
List<Object[]> lastPublished();
}
......@@ -484,6 +484,14 @@ public class DatasetServiceImpl implements DatasetService {
return datasetRepository.count(dataset.published.eq(true));
}
/**
* {@inheritDoc}
*/
@Override
public List<Object[]> lastPublished() {
return datasetRepository.lastPublished();
}
/**
* Copy values.
*
......
......@@ -20,6 +20,7 @@ import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.genesys.catalog.service.DatasetService;
import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.CropService;
......@@ -62,6 +63,9 @@ public class HtmlController extends BaseController {
@Autowired
private GenesysService genesysService;
@Autowired
private DatasetService datasetService;
@RequestMapping("/")
public String index(HttpServletRequest request) {
......@@ -94,6 +98,7 @@ public class HtmlController extends BaseController {
model.addAttribute("numberOfHistoricAccessions", statisticsService.numberOfHistoricAccessions());
model.addAttribute("numberOfPublishedDatasets", statisticsService.numberOfPublishedDatasets());
model.addAttribute("accessionsUpdates", genesysService.getLastUpdatedStatistics());
model.addAttribute("lastDatasetsUpdates", datasetService.lastPublished());
model.addAttribute("organizations", organizationService.list(new PageRequest(0, 5)));
......
......@@ -773,6 +773,8 @@ menu.admin.beanshell=Beanshell
news.content.page.all.title=News list
news.archive.title=News Archive
news.datasets.last-published=Last published datasets
news.datasets.last-published.intro=Last published datasets by date of last update, title and data provider
worldclim.monthly.title=Climate at collecting site
worldclim.monthly.precipitation.title=Monthly precipitation
......
......@@ -185,6 +185,39 @@
</div>
</div>
<c:if test="${lastDatasetsUpdates.size() gt 0}">
<div class="post type-article">
<div class="post-head clearfix" x-href="<c:url value='${genesysCatalogUrl}/datasets' />">
<div class="user-icon hidden-sm hidden-xs"></div>
<div class="post-head-content" dir="ltr">
<p><spring:message code='news.datasets.last-published' /></p>
</div>
</div>
<div class="post-inner clearfix post-left-pad">
<div class="post-content" dir="ltr" style="margin-bottom: 22px;">
<p><spring:message code='news.datasets.last-published.intro' /></p>
<c:forEach items="${lastDatasetsUpdates}" var="update" begin="0" end="4">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-4">
<b>
<c:if test="${update[0] ne null}">
${update[2]} ${monthNames[update[1]-1]} ${update[0]}
</c:if>
<c:if test="${update[0] eq null}">
----
</c:if>
</b>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-4"><a href="<c:url value='${genesysCatalogUrl}/datasets/${update[4]}' />">${update[3]}</a></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-4 text-right"><b>${update[5]}</b></div>
</div>
</c:forEach>
</div>
</div>
</div>
</c:if>
<c:forEach items="${lastNews}" var="activityPost" varStatus="status">
<cms:activitypost activityPost="${activityPost}" />
</c:forEach>
......
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