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:
parent
770fbda6b5
commit
b5b3add26c
4 changed files with 42 additions and 146 deletions
|
@ -79,7 +79,6 @@ display:People
|
||||||
a display:Page ;
|
a display:Page ;
|
||||||
a display:ClassGroupPage;
|
a display:ClassGroupPage;
|
||||||
display:forClassGroup vivoweb:vitroClassGrouppeople ;
|
display:forClassGroup vivoweb:vitroClassGrouppeople ;
|
||||||
display:requiresBodyTemplate "menupage--classgroup-people.ftl" ;
|
|
||||||
display:title "People" ;
|
display:title "People" ;
|
||||||
display:urlMapping "/people" ;
|
display:urlMapping "/people" ;
|
||||||
display:hasDataGetter display:peopleDataGetter .
|
display:hasDataGetter display:peopleDataGetter .
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
// This file extends and proxies the default behavior defined in vitro/webapp/web/js/menupage/browseByVClass.js
|
|
||||||
|
|
||||||
// Saving the original getIndividuals function from browseByVClass
|
|
||||||
var getPersonIndividuals = browseByVClass.getIndividuals;
|
|
||||||
|
|
||||||
// Assigning the proxy function
|
|
||||||
browseByVClass.getIndividuals = function(vclassUri, alpha, page, scroll) {
|
|
||||||
var url = this.dataServiceUrl + encodeURIComponent(vclassUri);
|
|
||||||
if ( alpha && alpha != "all") {
|
|
||||||
url = url + '&alpha=' + alpha;
|
|
||||||
}
|
|
||||||
if ( page ) {
|
|
||||||
url += '&page=' + page;
|
|
||||||
} else {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
if ( typeof scroll === "undefined" ) {
|
|
||||||
scroll = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll to #menupage-intro page unless told otherwise
|
|
||||||
if ( scroll != false ) {
|
|
||||||
// only scroll back up if we're past the top of the #browse-by section
|
|
||||||
var scrollPosition = browseByVClass.getPageScroll();
|
|
||||||
var browseByOffset = $('#browse-by').offset();
|
|
||||||
if ( scrollPosition[1] > browseByOffset.top) {
|
|
||||||
$.scrollTo('#menupage-intro', 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.getJSON(url, function(results) {
|
|
||||||
var individualList = "";
|
|
||||||
|
|
||||||
// Catch exceptions when empty individuals result set is returned
|
|
||||||
// This is very likely to happen now since we don't have individual counts for each letter and always allow the result set to be filtered by any letter
|
|
||||||
if ( !results.individuals || results.individuals.length == 0 ) {
|
|
||||||
browseByVClass.emptyResultSet(results.vclass, alpha)
|
|
||||||
} else {
|
|
||||||
var vclassName = results.vclass.name;
|
|
||||||
$.each(results.individuals, function(i, item) {
|
|
||||||
var individual,
|
|
||||||
label,
|
|
||||||
firstName,
|
|
||||||
lastName,
|
|
||||||
fullName,
|
|
||||||
mostSpecificTypes,
|
|
||||||
preferredTitle,
|
|
||||||
moreInfo,
|
|
||||||
uri,
|
|
||||||
profileUrl,
|
|
||||||
image,
|
|
||||||
listItem;
|
|
||||||
|
|
||||||
individual = results.individuals[i];
|
|
||||||
label = individual.label;
|
|
||||||
firstName = individual.firstName;
|
|
||||||
lastName = individual.lastName;
|
|
||||||
if ( firstName && lastName ) {
|
|
||||||
fullName = firstName + ' ' + lastName;
|
|
||||||
} else {
|
|
||||||
fullName = label;
|
|
||||||
}
|
|
||||||
mostSpecificTypes = individual.mostSpecificTypes;
|
|
||||||
if ( individual.preferredTitle ) {
|
|
||||||
preferredTitle = individual.preferredTitle;
|
|
||||||
moreInfo = browseByVClass.getMoreInfo(mostSpecificTypes, vclassName, preferredTitle);
|
|
||||||
} else {
|
|
||||||
moreInfo = browseByVClass.getMoreInfo(mostSpecificTypes, vclassName);
|
|
||||||
}
|
|
||||||
uri = individual.URI;
|
|
||||||
profileUrl = individual.profileUrl;
|
|
||||||
if ( !individual.thumbUrl ) {
|
|
||||||
image = browseByVClass.baseUrl + '/images/placeholders/person.thumbnail.jpg';
|
|
||||||
} else {
|
|
||||||
image = browseByVClass.baseUrl + individual.thumbUrl;
|
|
||||||
}
|
|
||||||
// Build the content of each list item, piecing together each component
|
|
||||||
listItem = '<li class="vcard individual foaf-person" role="listitem" role="navigation">';
|
|
||||||
listItem += '<img src="'+ image +'" width="90" alt="'+ fullName +'" />';
|
|
||||||
listItem += '<h1 class="fn thumb"><a href="'+ profileUrl +'" title="View the profile page for '+ fullName +'">'+ fullName +'</a></h1>';
|
|
||||||
if ( moreInfo != '' ) {
|
|
||||||
listItem += '<span class="title">'+ moreInfo +'</span>';
|
|
||||||
}
|
|
||||||
listItem += '</li>';
|
|
||||||
individualList += listItem;
|
|
||||||
})
|
|
||||||
|
|
||||||
// Remove existing content
|
|
||||||
browseByVClass.wipeSlate();
|
|
||||||
|
|
||||||
// And then add the new content
|
|
||||||
browseByVClass.individualsInVClass.append(individualList);
|
|
||||||
|
|
||||||
// Check to see if we're dealing with pagination
|
|
||||||
if ( results.pages.length ) {
|
|
||||||
var pages = results.pages;
|
|
||||||
browseByVClass.pagination(pages, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set selected class, alpha and page
|
|
||||||
// Do this whether or not there are any results
|
|
||||||
$('h3.selected-class').text(results.vclass.name);
|
|
||||||
browseByVClass.selectedVClass(results.vclass.URI);
|
|
||||||
browseByVClass.selectedAlpha(alpha);
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,35 +0,0 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
|
||||||
|
|
||||||
<#include "menupage-checkForData.ftl">
|
|
||||||
<#if !noData>
|
|
||||||
<section id="menupage-intro" class="people" role="region">
|
|
||||||
<h2>${page.title}</h2>
|
|
||||||
|
|
||||||
<section id="find-by" role="region">
|
|
||||||
<nav role="navigation">
|
|
||||||
<h3>Find By: </h3>
|
|
||||||
|
|
||||||
<#assign subjectAreaUri = "http://vivoweb.org/ontology/core#SubjectArea" />
|
|
||||||
<#assign departmentUri = "http://vivoweb.org/ontology/core#Department" />
|
|
||||||
<#assign courseUri = "http://vivoweb.org/ontology/core#Course" />
|
|
||||||
|
|
||||||
<ul id="find-filters">
|
|
||||||
<li><a href="${urls.base}/individuallist?vclassId=${subjectAreaUri?url}" title="subject area">Subject Area</a></li>
|
|
||||||
<li><a href="${urls.base}/individuallist?vclassId=${departmentUri?url}" title="department">Department</a></li>
|
|
||||||
<li><a href="${urls.base}/individuallist?vclassId=${courseUri?url}" title="courses">Courses</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<#include "menupage-browse.ftl">
|
|
||||||
|
|
||||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menupage.css" />')}
|
|
||||||
|
|
||||||
<#include "menupage-scripts.ftl">
|
|
||||||
|
|
||||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/menupage/browseByVClassPeople.js"></script>')}
|
|
||||||
|
|
||||||
<#else>
|
|
||||||
${noDataNotification}
|
|
||||||
</#if>
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<#-- $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>
|
||||||
|
|
||||||
|
<#if (extra[0].pt)?? >
|
||||||
|
<span class="title">${extra[0].pt}</span>
|
||||||
|
<#else>
|
||||||
|
<#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>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue