enabling autocomplete selection when editing an existing relationship with uri to work correctly, specifically in the context of subject areas for the person has advising relationship form
This commit is contained in:
parent
8e82c65ec4
commit
e1cedc156d
3 changed files with 21 additions and 5 deletions
|
@ -254,6 +254,10 @@ var customForm = {
|
||||||
$(selectedObj).autocomplete({
|
$(selectedObj).autocomplete({
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
|
//Reset the URI of the input to one that says new uri required
|
||||||
|
//That will be overwritten if value selected from autocomplete
|
||||||
|
//We do this everytime the user types anything in the autocomplete box
|
||||||
|
customForm.initDefaultNewURI(selectedObj);
|
||||||
if (request.term in customForm.acCache) {
|
if (request.term in customForm.acCache) {
|
||||||
// console.log('found term in cache');
|
// console.log('found term in cache');
|
||||||
response(customForm.acCache[request.term]);
|
response(customForm.acCache[request.term]);
|
||||||
|
@ -442,7 +446,9 @@ var customForm = {
|
||||||
$acSelector.parent("p").show();
|
$acSelector.parent("p").show();
|
||||||
this.hideFields($acSelectionObj);
|
this.hideFields($acSelectionObj);
|
||||||
$acSelectionObj.removeClass('userSelected');
|
$acSelectionObj.removeClass('userSelected');
|
||||||
$acSelectionObj.find("input.acUriReceiver").val('');
|
//Might be useful here to replace the uri with the default "new uri needs to be created" value
|
||||||
|
//$acSelectionObj.find("input.acUriReceiver").val('');
|
||||||
|
$acSelectionObj.find("input.acUriReceiver").val(customForm.newUriSentinel);
|
||||||
$acSelectionObj.find("span").text('');
|
$acSelectionObj.find("span").text('');
|
||||||
$acSelectionObj.find("a.verifyMatch").attr('href', this.baseHref);
|
$acSelectionObj.find("a.verifyMatch").attr('href', this.baseHref);
|
||||||
$acSelector.val('');
|
$acSelector.val('');
|
||||||
|
@ -553,6 +559,13 @@ var customForm = {
|
||||||
enableSubmit:function() {
|
enableSubmit:function() {
|
||||||
this.button.removeAttr('disabled');
|
this.button.removeAttr('disabled');
|
||||||
this.button.removeClass('disabledSubmit');
|
this.button.removeClass('disabledSubmit');
|
||||||
|
},
|
||||||
|
initDefaultNewURI:function(selectedObj) {
|
||||||
|
//get uri input for selected object and set to value indicating
|
||||||
|
//this will require a new uri when submitted if the uri is not replaced
|
||||||
|
//with one selected from autocomplete selection
|
||||||
|
var $acDiv = this.acSelections[$(selectedObj).attr('acGroupName')];
|
||||||
|
$acDiv.find("input").val(customForm.newUriSentinel);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#assign newUriSentinel = "" />
|
||||||
|
<#if editConfigurationConstants?has_content>
|
||||||
|
<#assign newUriSentinel = editConfigurationConstants["NEW_URI_SENTINEL"] />
|
||||||
|
</#if>
|
||||||
<#-- this is in request.subject.name -->
|
<#-- this is in request.subject.name -->
|
||||||
|
|
||||||
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
|
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
|
||||||
|
@ -187,7 +190,8 @@ var customFormData = {
|
||||||
sparqlForAcFilter: '${sparqlForAcFilter}',
|
sparqlForAcFilter: '${sparqlForAcFilter}',
|
||||||
sparqlQueryUrl: '${sparqlQueryUrl}',
|
sparqlQueryUrl: '${sparqlQueryUrl}',
|
||||||
acFilterForIndividuals: ${acFilterForIndividuals},
|
acFilterForIndividuals: ${acFilterForIndividuals},
|
||||||
baseHref: '${urls.base}/individual?uri='
|
baseHref: '${urls.base}/individual?uri=',
|
||||||
|
newUriSentinel : '${newUriSentinel}'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,7 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
|
||||||
degreeAssertion,
|
degreeAssertion,
|
||||||
firstNameAssertion,
|
firstNameAssertion,
|
||||||
lastNameAssertion,
|
lastNameAssertion,
|
||||||
n3ForSubjAreaAssertion,
|
n3ForSubjAreaAssertion + "\n" + subjAreaLabelAssertion, //putting these statements together to prevent an empty label from generating a new URI
|
||||||
subjAreaLabelAssertion,
|
|
||||||
n3ForStart,
|
n3ForStart,
|
||||||
n3ForEnd ) );
|
n3ForEnd ) );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue