VIVO-296 autocomplete on concepts will no longer include subclasses such as Award
This commit is contained in:
parent
c062201a9a
commit
9cff04ce95
1 changed files with 18 additions and 3 deletions
|
@ -297,6 +297,7 @@ var customForm = {
|
||||||
//to the filtering list
|
//to the filtering list
|
||||||
this.getAcFilterForIndividuals();
|
this.getAcFilterForIndividuals();
|
||||||
this.acCache = {};
|
this.acCache = {};
|
||||||
|
var theType = customForm.acTypes[$(selectedObj).attr('acGroupName')];
|
||||||
|
|
||||||
$(selectedObj).autocomplete({
|
$(selectedObj).autocomplete({
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
|
@ -316,13 +317,17 @@ var customForm = {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
term: request.term,
|
term: request.term,
|
||||||
type: customForm.acTypes[$(selectedObj).attr('acGroupName')],
|
type: theType,
|
||||||
multipleTypes:(customForm.acMultipleTypes == undefined || customForm.acMultipleTypes == null)? null: customForm.acMultipleTypes
|
multipleTypes:(customForm.acMultipleTypes == undefined || customForm.acMultipleTypes == null)? null: customForm.acMultipleTypes
|
||||||
},
|
},
|
||||||
complete: function(xhr, status) {
|
complete: function(xhr, status) {
|
||||||
// Not sure why, but we need an explicit json parse here.
|
// Not sure why, but we need an explicit json parse here.
|
||||||
var results = $.parseJSON(xhr.responseText),
|
var results = $.parseJSON(xhr.responseText);
|
||||||
filteredResults = customForm.filterAcResults(results);
|
var filteredResults = customForm.filterAcResults(results);
|
||||||
|
|
||||||
|
if ( theType == "http://www.w3.org/2004/02/skos/core#Concept" ) {
|
||||||
|
filteredResults = customForm.removeConceptSubclasses(filteredResults);
|
||||||
|
}
|
||||||
|
|
||||||
customForm.acCache[request.term] = filteredResults;
|
customForm.acCache[request.term] = filteredResults;
|
||||||
response(filteredResults);
|
response(filteredResults);
|
||||||
|
@ -423,6 +428,16 @@ var customForm = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
removeConceptSubclasses: function(array) {
|
||||||
|
$(array).each(function(i) {
|
||||||
|
if(this["msType"] != "http://www.w3.org/2004/02/skos/core#Concept") {
|
||||||
|
//Remove from array
|
||||||
|
array.splice(i, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return array;
|
||||||
|
},
|
||||||
|
|
||||||
showAutocompleteSelection: function(label, uri, selectedObj) {
|
showAutocompleteSelection: function(label, uri, selectedObj) {
|
||||||
// hide the acSelector field and set it's value to the selected ac item
|
// hide the acSelector field and set it's value to the selected ac item
|
||||||
this.hideFields($(selectedObj).parent());
|
this.hideFields($(selectedObj).parent());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue