NIHVIVO-2449 In search results, display preferredTitle with fallback to mostSpecificTypes

This commit is contained in:
ryounes 2011-07-06 19:02:49 +00:00
parent cb5f5ed18c
commit 9ee6a96c55
4 changed files with 53 additions and 1 deletions

View file

@ -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 />

View 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>

View file

@ -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 {

View file

@ -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");
}
}