NIHVIVO-2449 In search results, display preferredTitle with fallback to mostSpecificTypes
This commit is contained in:
parent
cb5f5ed18c
commit
9ee6a96c55
4 changed files with 53 additions and 1 deletions
|
@ -0,0 +1,9 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#-- Default individual search view -->
|
||||||
|
|
||||||
|
<#import "lib-vivo-properties.ftl" as p>
|
||||||
|
|
||||||
|
<a href="${individual.profileUrl}">${individual.name}</a>
|
||||||
|
|
||||||
|
<@p.displayTitle individual />
|
14
productMods/templates/freemarker/lib/lib-vivo-properties.ftl
Normal file
14
productMods/templates/freemarker/lib/lib-vivo-properties.ftl
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#-- Macros related to the display of vivo ontology properties -->
|
||||||
|
|
||||||
|
<#import "lib-properties.ftl" as p>
|
||||||
|
|
||||||
|
<#-- Display preferredTitle if it exists; otherwise display mostSpecificTypes -->
|
||||||
|
<#macro displayTitle individual>
|
||||||
|
<#if individual.preferredTitle?has_content>
|
||||||
|
<span class="display-title">${individual.preferredTitle}</span>
|
||||||
|
<#else>
|
||||||
|
<@p.mostSpecificTypes individual />
|
||||||
|
</#if>
|
||||||
|
</#macro>
|
|
@ -1,12 +1,14 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
|
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
|
||||||
|
|
||||||
public class ListedIndividual extends BaseListedIndividual {
|
public class ListedIndividual extends BaseListedIndividual {
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
|
||||||
|
public class IndividualSearchResult extends BaseIndividualSearchResult {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
|
||||||
|
|
||||||
|
private static final String CORE = "http://vivoweb.org/ontology/core#";
|
||||||
|
|
||||||
|
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
|
||||||
|
super(individual, vreq);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Access methods for templates */
|
||||||
|
|
||||||
|
public String getPreferredTitle() {
|
||||||
|
return individual.getDataValue(CORE + "preferredTitle");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue