NIHVIVO-823 Turn off autocomplete filtering on roles form, since a person can have multiple roles on the same activity. Also turn off autocomplete altogether in edit mode.
This commit is contained in:
parent
958474914b
commit
90eabc5fdd
2 changed files with 17 additions and 5 deletions
|
@ -358,7 +358,6 @@ SELECT ?indUri WHERE {<${subjectUri}> <${predicateUri}> ?role . ?role <${vivoCor
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var customFormData = {
|
var customFormData = {
|
||||||
sparqlForAcFilter: '${sparqlForAcFilter}',
|
|
||||||
sparqlQueryUrl: '${sparqlQueryUrl}',
|
sparqlQueryUrl: '${sparqlQueryUrl}',
|
||||||
acUrl: '${acUrl}',
|
acUrl: '${acUrl}',
|
||||||
editMode: '${editMode}',
|
editMode: '${editMode}',
|
||||||
|
|
|
@ -177,6 +177,10 @@ var customForm = {
|
||||||
|
|
||||||
initAutocomplete: function() {
|
initAutocomplete: function() {
|
||||||
|
|
||||||
|
if (this.editMode === 'edit') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.getAcFilter();
|
this.getAcFilter();
|
||||||
this.acCache = {};
|
this.acCache = {};
|
||||||
|
|
||||||
|
@ -205,7 +209,6 @@ var customForm = {
|
||||||
customForm.acCache[request.term] = filteredResults;
|
customForm.acCache[request.term] = filteredResults;
|
||||||
response(filteredResults);
|
response(filteredResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
|
@ -217,6 +220,15 @@ var customForm = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getAcFilter: function() {
|
getAcFilter: function() {
|
||||||
|
|
||||||
|
if (!this.sparqlForAcFilter) {
|
||||||
|
//console.log('autocomplete filtering turned off');
|
||||||
|
this.acFilter = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log("sparql for autocomplete filter: " + this.sparqlForAcFilter);
|
||||||
|
|
||||||
// Define this.acFilter here, so in case the sparql query fails
|
// Define this.acFilter here, so in case the sparql query fails
|
||||||
// we don't get an error when referencing it later.
|
// we don't get an error when referencing it later.
|
||||||
this.acFilter = [];
|
this.acFilter = [];
|
||||||
|
@ -245,18 +257,19 @@ var customForm = {
|
||||||
filterAcResults: function(results) {
|
filterAcResults: function(results) {
|
||||||
var filteredResults;
|
var filteredResults;
|
||||||
|
|
||||||
if (!this.acFilter.length) {
|
if (!this.acFilter || !this.acFilter.length) {
|
||||||
|
//console.log('no autocomplete filtering applied');
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
filteredResults = [];
|
filteredResults = [];
|
||||||
$.each(results, function() {
|
$.each(results, function() {
|
||||||
if ($.inArray(this.uri, customForm.acFilter) == -1) {
|
if ($.inArray(this.uri, customForm.acFilter) == -1) {
|
||||||
// console.log('adding ' + this.label + ' to filtered results');
|
//console.log('adding ' + this.label + ' to filtered results');
|
||||||
filteredResults.push(this);
|
filteredResults.push(this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// console.log('filtering out ' + this.label);
|
//console.log('filtering out ' + this.label);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return filteredResults;
|
return filteredResults;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue