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

Updated Country page

parent c7bda943
......@@ -66,10 +66,10 @@ public class CountryController extends BaseController {
public String view(ModelMap model) {
List<Country> countries = geoService.listActive(getLocale());
model.addAttribute("countries", countries);
List<String> firstLetters = countries.stream().map(country -> country.getName(getLocale()).substring(0, 1)).distinct().collect(Collectors.toList());
model.addAttribute("firstLetters", firstLetters);
return "/country/index";
}
......@@ -102,13 +102,31 @@ public class CountryController extends BaseController {
return "/country/details";
}
@RequestMapping("/{country}/map")
public String map(ModelMap model, @PathVariable(value = "country") String countryStr) {
view(model, countryStr);
/**
* Url redirect to display accessions from specified country
*/
@RequestMapping("/{country}/accessionmap")
public String accessionMap(ModelMap model, @PathVariable(value = "country") String countryStr) {
final Country country = geoService.getCountry(countryStr);
if (country == null) {
throw new ResourceNotFoundException();
}
@SuppressWarnings("unchecked")
final List<FaoInstitute> institutes = (List<FaoInstitute>) model.get("faoInstitutes");
model.addAttribute("filter", "{\"" + FilterConstants.ORGCTY_ISO3 + "\":[\"" + country.getCode3() + "\"]}");
return "redirect:/explore/map";
}
/**
* Map of institutes
*/
@RequestMapping("/{country}/map")
public String map(ModelMap model, @PathVariable(value = "country") String countryStr) {
final Country country = geoService.getCountry(countryStr);
if (country == null) {
throw new ResourceNotFoundException();
}
final List<FaoInstitute> institutes = instituteService.listByCountry(country);
model.addAttribute("jsonInstitutes", geoService.toJson(institutes).toString());
return "/country/map";
......@@ -136,8 +154,7 @@ public class CountryController extends BaseController {
}
@RequestMapping("/{country}/data")
public String viewData(ModelMap model, @PathVariable(value = "country") String countryStr,
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
public String viewData(ModelMap model, @PathVariable(value = "country") String countryStr, @RequestParam(value = "page", required = false, defaultValue = "1") int page) {
_logger.debug("Viewing country " + countryStr);
final Country country = geoService.getCountry(countryStr);
if (country == null) {
......@@ -158,8 +175,7 @@ public class CountryController extends BaseController {
}
AppliedFilters appliedFilters = new AppliedFilters();
appliedFilters.add(new AppliedFilter().setFilterName(FilterConstants.ORGCTY_ISO3).addFilterValue(
new FilterHandler.LiteralValueFilter(country.getCode3())));
appliedFilters.add(new AppliedFilter().setFilterName(FilterConstants.ORGCTY_ISO3).addFilterValue(new FilterHandler.LiteralValueFilter(country.getCode3())));
return "forward:/explore/overview?filter=" + URLEncoder.encode(appliedFilters.toString(), "UTF8");
}
......
......@@ -151,19 +151,19 @@ crop.summary=Summary (HTML metadata)
activity.recent-activity=Recent activity
country.page.title=Countries
country.page.profile.title=Country profile: {0}
country.page.list.title=Country list
country.page.list.intro=By clicking on a country name, you can find registered institutes in the country as well as statistics on plant genetic resources in the country as a whole.
country.page.not-current=This is a historic entry.
country.page.faoInstitutes={0} institutes registered in WIEWS
country.stat.countByLocation={0} accessions at institutes in this country
country.stat.countByOrigin={0}
country.stat.countByOrigin={0} accessions registered in Genesys come from this country.
country.stat.accessionCount=Accessions in Genesys:
country.statistics=Country statistics
country.accessions.from=Accessions collected in {0}
country.more-information=More information:
country.replaced-by=Country code is replaced by: {0}
country.is-itpgrfa-contractingParty=ITPGRFA
country.is-itpgrfa-contractingParty={0} is party to the International Treaty on Plant Genetic Resources for Food and Agriculture (ITPGRFA).
select-country=Select country
project.page.list.title=Projects
......@@ -834,3 +834,4 @@ repository.gallery.downloadImage=Download image
welcome.search-genesys=Search Genesys
welcome.networks=Networks
geo.country=Country:
......@@ -10,43 +10,21 @@
</head>
<body class="country-page">
<cms:informative-h1 title="country.page.title" />
<!-- Is country current? -->
<gui:alert type="info" display="${not country.current}">
<spring:message code="country.page.not-current" />
<c:if test="${country.replacedBy != null}">
<spring:message code="country.replaced-by" arguments="${country.replacedBy.code3}" />
<a href="${country.replacedBy.code3}"><c:out value="${country.replacedBy.getName(pageContext.response.locale)}" /></a>
</c:if>
</gui:alert>
<%--<div class="jumbotron">
<spring:message code="country.stat.countByOrigin" arguments="${countByOrigin}" />
<c:if test="${countByOrigin gt 0}">
<a href="<c:url value="/geo/${country.code3}/data" />"><spring:message code="view.accessions" /></a>
<a href="<c:url value="/geo/${country.code3}/overview" />"><spring:message code="data-overview.short" /></a>
</c:if>
</div>--%>
<cms:informative-h1 title="country.page.profile.title" titleArgument="${country.getName(pageContext.response.locale)}" />
<security:authorize access="hasRole('ADMINISTRATOR')">
<a href="<c:url value="/geo/${country.code3}/edit" />" class="close"> <spring:message code="edit" />
</a>
</security:authorize>
<cms:blurb blurb="${blurp}" />
<gui:alert type="info" display="${itpgrfa != null and itpgrfa.contractingParty=='Yes'}">
<spring:message code="country.is-itpgrfa-contractingParty" arguments="${country.getName(pageContext.response.locale)}" argumentSeparator="|" />
</gui:alert>
<div class="row map-wrapper dark-background">
<div class="country-info-wrapper clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 country-info collect-info">
<h1><c:out value="${country.getName(pageContext.response.locale)}" /></h1>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-4"><p>Country:</p></div>
<div class="col-lg-9 col-md-9 col-sm-6 col-xs-8"><p>Countries&nbsp;<span class="glyphicon glyphicon-menu-right"></span>&nbsp;<c:out value="${country.getName(pageContext.response.locale)}" /></p></div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-4"><p><spring:message code="geo.country" /></p></div>
<div class="col-lg-9 col-md-9 col-sm-6 col-xs-8"><p><a href="<c:url value="/geo" />"><spring:message code="country.page.list.title"/></a> <span class="glyphicon glyphicon-menu-right"></span> <c:out value="${country.getName(pageContext.response.locale)}" /></p></div>
</div>
<div class="row">
<c:if test="${country.wikiLink ne null}">
......@@ -55,16 +33,12 @@
</c:if>
</div>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-4"><p>Organizations and Networks:</p></div>
<div class="col-lg-9 col-md-9 col-sm-6 col-xs-8"><p><spring:message code="country.is-itpgrfa-contractingParty" arguments="${country.getName(pageContext.response.locale)}" argumentSeparator="|" /></p></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-4"><p>Accessions in Genesys:</p></div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-4"><p><spring:message code="country.stat.accessionCount" /></p></div>
<div class="col-lg-9 col-md-9 col-sm-6 col-xs-8">
<p><span><spring:message code="country.stat.countByOrigin" arguments="${countByOrigin}" /></span></p>
<p><span><c:out value="${countByOrigin}" /></span></p>
<p class="buttons-container pull-right">
<a class="btn btn-primary" title="" href="<c:url value="/geo/${country.code3}/data" />"> <span class="glyphicon glyphicon-list"></span> <spring:message code="view.accessions" /></a>
<a class="btn btn-default" id="mapLink" href="<c:url value="/explore/map"><c:param name="filter">${jsonFilter}</c:param></c:url>"><span class="glyphicon glyphicon-globe"></span><span><spring:message code="maps.view-map"/></span></a>
<a class="btn btn-default" id="mapLink" href="<c:url value="/geo/${country.code3}/accessionmap" />"><span class="glyphicon glyphicon-globe"></span><span><spring:message code="maps.view-map"/></span></a>
</p>
</div>
</div>
......@@ -97,6 +71,22 @@
</div>
</div>
<cms:blurb blurb="${blurp}" />
<!-- Is country current? -->
<gui:alert type="info" display="${not country.current}">
<spring:message code="country.page.not-current" />
<c:if test="${country.replacedBy != null}">
<spring:message code="country.replaced-by" arguments="${country.replacedBy.code3}" />
<a href="${country.replacedBy.code3}"><c:out value="${country.replacedBy.getName(pageContext.response.locale)}" /></a>
</c:if>
</gui:alert>
<gui:alert type="info" display="${itpgrfa != null and itpgrfa.contractingParty=='Yes'}">
<spring:message code="country.is-itpgrfa-contractingParty" arguments="${country.getName(pageContext.response.locale)}" argumentSeparator="|" />
</gui:alert>
<%--<h3><spring:message code="country.statistics" /></h3>--%>
<div class="collect-info inst-accs">
......
......@@ -6,6 +6,7 @@
<%@ taglib prefix="local" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="cms" tagdir="/WEB-INF/tags/cms" %>
<%@ attribute name="title" required="true" type="java.lang.String" %>
<%@ attribute name="titleArgument" required="false" type="java.lang.String" %>
<%@ attribute name="fancy" required="false" rtexprvalue="true" type="java.lang.Boolean" %>
<%@ attribute name="info" required="false" type="java.lang.String" %>
......@@ -13,7 +14,7 @@
<div class="informative-h1 green-bg row">
<div class="col-md-12 col-sm-12">
<h1>
<spring:message code="${title}" />
<spring:message code="${title}" arguments="${titleArgument}" />
</h1>
<c:if test="${info ne null and info ne ''}">
<p><spring:message code="${info}" /></p>
......@@ -28,7 +29,7 @@
<div class="informative-h1 green-bg row">
<div class="col-md-12 col-sm-12">
<h1>
<spring:message code="${title}" />
<spring:message code="${title}" arguments="${titleArgument}" />
</h1>
</div>
</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