From b5b3add26c3af48875d7b4852588e3619dd9c2f9 Mon Sep 17 00:00:00 2001 From: j2blake Date: Tue, 1 May 2012 16:29:33 +0000 Subject: [PATCH] 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. --- productMods/WEB-INF/ontologies/app/menu.n3 | 1 - .../js/menupage/browseByVClassPeople.js | 110 ------------------ .../menupage/menupage--classgroup-people.ftl | 35 ------ .../class/view/short/view-browse-people.ftl | 42 +++++++ 4 files changed, 42 insertions(+), 146 deletions(-) delete mode 100644 productMods/js/menupage/browseByVClassPeople.js delete mode 100644 productMods/templates/freemarker/body/menupage/menupage--classgroup-people.ftl create mode 100644 productMods/templates/freemarker/body/partials/class/view/short/view-browse-people.ftl diff --git a/productMods/WEB-INF/ontologies/app/menu.n3 b/productMods/WEB-INF/ontologies/app/menu.n3 index 7ce75a01..70d23d1e 100644 --- a/productMods/WEB-INF/ontologies/app/menu.n3 +++ b/productMods/WEB-INF/ontologies/app/menu.n3 @@ -79,7 +79,6 @@ display:People a display:Page ; a display:ClassGroupPage; display:forClassGroup vivoweb:vitroClassGrouppeople ; - display:requiresBodyTemplate "menupage--classgroup-people.ftl" ; display:title "People" ; display:urlMapping "/people" ; display:hasDataGetter display:peopleDataGetter . diff --git a/productMods/js/menupage/browseByVClassPeople.js b/productMods/js/menupage/browseByVClassPeople.js deleted file mode 100644 index 195a8a57..00000000 --- a/productMods/js/menupage/browseByVClassPeople.js +++ /dev/null @@ -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 = '
  • '; - listItem += ''+ fullName +''; - listItem += '

    '+ fullName +'

    '; - if ( moreInfo != '' ) { - listItem += ''+ moreInfo +''; - } - listItem += '
  • '; - 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); - }); -}; \ No newline at end of file diff --git a/productMods/templates/freemarker/body/menupage/menupage--classgroup-people.ftl b/productMods/templates/freemarker/body/menupage/menupage--classgroup-people.ftl deleted file mode 100644 index 295e279f..00000000 --- a/productMods/templates/freemarker/body/menupage/menupage--classgroup-people.ftl +++ /dev/null @@ -1,35 +0,0 @@ -<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> - -<#include "menupage-checkForData.ftl"> -<#if !noData> - - - <#include "menupage-browse.ftl"> - - ${stylesheets.add('')} - - <#include "menupage-scripts.ftl"> - - ${scripts.add('')} - -<#else> - ${noDataNotification} - \ No newline at end of file diff --git a/productMods/templates/freemarker/body/partials/class/view/short/view-browse-people.ftl b/productMods/templates/freemarker/body/partials/class/view/short/view-browse-people.ftl new file mode 100644 index 00000000..e9bd8ce9 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/class/view/short/view-browse-people.ftl @@ -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> + +
  • + +<#if (individual.thumbUrl)??> + ${individual.name} +

    + ${individual.name} +

    +<#else> +

    + ${individual.name} +

    + + +<#if (extra[0].pt)?? > + ${extra[0].pt} +<#else> + <#assign typesString> + [<#list individual.mostSpecificTypes as type><#if type != vclass>,"${type}"] + + <#assign cleanTypes = typesString?replace("[,", "[")?eval > + + <#if cleanTypes?size == 1> + ${cleanTypes[0]} + <#elseif (cleanTypes?size > 1) > + +
      + <#list cleanTypes as type> +
    • ${type}
    • + +
    +
    + + + +
  • +