NIHVIVO-2411 Modify ClassGroupPageData.java and browseByVClass.js to use the new BROWSE short view. This means that the VIVO-specific browseByVClassPeople.js and menupage--classgroup-people.ftl can be replaced by a VIVO-specific short view.

This commit is contained in:
j2blake 2012-05-01 16:29:36 +00:00
parent 47b3565e58
commit af3ca17ef1
4 changed files with 152 additions and 78 deletions

View file

@ -105,36 +105,8 @@ var browseByVClass = {
} else {
var vclassName = results.vclass.name;
$.each(results.individuals, function(i, item) {
var individual,
label,
mostSpecificTypes,
uri,
profileUrl,
image,
listItem;
individual = results.individuals[i];
label = individual.label;
mostSpecificTypes = individual.mostSpecificTypes;
moreInfo = browseByVClass.getMoreInfo(mostSpecificTypes, vclassName);
uri = individual.URI;
profileUrl = individual.profileUrl;
if ( individual.thumbUrl ) {
image = browseByVClass.baseUrl + individual.thumbUrl;
}
// Build the content of each list item, piecing together each component
listItem = '<li class="individual" role="listitem" role="navigation">';
if ( typeof individual.thumbUrl !== "undefined" ) {
listItem += '<img src="'+ image +'" width="90" alt="'+ label +'" /><h1 class="thumb">';
} else {
listItem += '<h1>';
}
listItem += '<a href="'+ profileUrl +'" title="View the profile page for '+ label +'">'+ label +'</a></h1>';
if ( moreInfo != '' ) {
listItem += '<span class="title">'+ moreInfo +'</span>';
}
listItem += '</li>';
individualList += listItem;
var individual = results.individuals[i];
individualList += individual.shortViewHtml;
})
// Remove existing content
@ -158,32 +130,6 @@ var browseByVClass = {
});
},
// Handle mostSpecificType as array
// * remove requested class for redundancy
// * allow override by another property (passed as argument)
getMoreInfo: function(mostSpecificTypes, requestedClass, override) {
var requestedClassIndex = $.inArray(requestedClass, mostSpecificTypes);
if ( requestedClassIndex > -1 ) {
mostSpecificTypes.splice(requestedClassIndex, 1);
}
var mostSpecificTypeCount = mostSpecificTypes.length;
if ( typeof override !== "undefined" ) {
return override;
} else {
if ( mostSpecificTypeCount > 1 ) {
var assembledList = '<ul class="mostSpecificTypes">';
$.each(mostSpecificTypes, function(i, item) {
assembledList += '<li>'+ item +'</li>';
})
assembledList += '</ul>';
return assembledList;
} else {
return mostSpecificTypes;
}
}
},
// getPageScroll() by quirksmode.org
getPageScroll: function() {
var xScroll, yScroll;

View file

@ -0,0 +1,37 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Default individual browse view -->
<#import "lib-properties.ftl" as p>
<li class="individual" role="listitem" role="navigation">
<#if (individual.thumbUrl)??>
<img src="${individual.thumbUrl}" width="90" alt="${individual.name}" />
<h1 class="thumb">
<a href="${individual.profileUrl}" title="View the profile page for ${individual.name}}">${individual.name}</a>
</h1>
<#else>
<h1>
<a href="${individual.profileUrl}" title="View the profile page for ${individual.name}}">${individual.name}</a>
</h1>
</#if>
<#assign typesString>
[<#list individual.mostSpecificTypes as type><#if type != vclass>,"${type}"</#if></#list>]
</#assign>
<#assign cleanTypes = typesString?replace("[,", "[")?eval >
<#if cleanTypes?size == 1>
<span class="title">${cleanTypes[0]}</span>
<#elseif (cleanTypes?size > 1) >
<span class="title">
<ul>
<#list cleanTypes as type>
<li>${type}</li>
</#list>
</ul>
</span>
</#if>
</li>