NIHVIVO-725, NIHVIVO-629 Working on cancel action on autocomplete selection view. Fixed code that parses sparql query for autocomplete filter so it gets key from the data returned, rather than looking for a hard-coded key.
This commit is contained in:
parent
afdbea1db7
commit
56e38dae96
3 changed files with 34 additions and 19 deletions
|
@ -89,9 +89,9 @@ if ( ((String)request.getAttribute("predicateUri")).endsWith("hasPrincipalInvest
|
|||
?grant rdfs:label ?grantLabel .
|
||||
</v:jsonset>
|
||||
|
||||
<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%>
|
||||
<%-- Must be all one line for JavaScript. --%>
|
||||
<c:set var="sparqlForAcFilter">
|
||||
PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?individual .}
|
||||
PREFIX core: <${vivoCore}> SELECT ?grantUri WHERE {<${subjectUri}> core:hasPrincipalInvestigatorRole ?grantRole .?grantRole core:relatedRole ?grantUri .}
|
||||
</c:set>
|
||||
|
||||
<v:jsonset var="grantTypeUriJson">${vivoOnt}#Grant</v:jsonset>
|
||||
|
|
|
@ -102,9 +102,9 @@ SPARQL queries for existing values. --%>
|
|||
?pubUri core:informationResourceInAuthorship ?authorshipUri .
|
||||
</v:jsonset>
|
||||
|
||||
<%-- Must be all one line for JavaScript. Must use ?individual since Javascript will look for that property in the data returned. --%>
|
||||
<%-- Must be all one line for JavaScript. --%>
|
||||
<c:set var="sparqlForAcFilter">
|
||||
PREFIX core: <${vivoCore}> SELECT ?individual WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri .?authorshipUri core:linkedInformationResource ?individual .}
|
||||
PREFIX core: <${vivoCore}> SELECT ?pubUri WHERE {<${subjectUri}> core:authorInAuthorship ?authorshipUri .?authorshipUri core:linkedInformationResource ?pubUri .}
|
||||
</c:set>
|
||||
|
||||
<c:set var="publicationsClassGroupUri" value="${vivoOnt}#vitroClassGrouppublications" />
|
||||
|
|
|
@ -89,9 +89,10 @@ var customForm = {
|
|||
this.requiredLegend.show();
|
||||
this.button.show();
|
||||
this.button.val('Create ' + this.baseButtonText);
|
||||
this.cancel.unbind('click');
|
||||
|
||||
if( this.formSteps > 1 ){
|
||||
this.cancel.unbind('click');
|
||||
|
||||
this.cancel.click(function() {
|
||||
customForm.clearFormData(); // clear any input and validation errors
|
||||
customForm.initFormTypeView();
|
||||
|
@ -184,9 +185,10 @@ var customForm = {
|
|||
},
|
||||
|
||||
setAcFilter: function(data) {
|
||||
var filter = [];
|
||||
var filter = [],
|
||||
key = data.head.vars[0];
|
||||
$.each(data.results.bindings, function() {
|
||||
filter.push(this.individual.value);
|
||||
filter.push(this[key].value);
|
||||
});
|
||||
this.acFilter = filter;
|
||||
},
|
||||
|
@ -239,14 +241,27 @@ var customForm = {
|
|||
|
||||
this.button.val('Add ' + this.baseButtonText);
|
||||
|
||||
if( this.formSteps > 1){
|
||||
this.cancel.unbind('click');
|
||||
this.cancel.click(function() {
|
||||
// TODO Check out cancel action for authors form. Need to undo/empty some of the stuff above.
|
||||
//do we do it in the initfullview method, or here?
|
||||
customForm.initFormFullView();
|
||||
return false;
|
||||
});
|
||||
this.cancel.unbind('click');
|
||||
this.cancel.click(function() {
|
||||
customForm.undoAutocompleteSelection();
|
||||
customForm.initFormFullView();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
// Cancel action after making an autocomplete selection: undo autocomplete
|
||||
// selection (from showAutocomplete) before returning to full view.
|
||||
undoAutocompleteSelection: function() {
|
||||
|
||||
this.acSelectorWrapper.show();
|
||||
this.hideFields(this.acSelection);
|
||||
this.acReceiver.val('');
|
||||
this.acSelectionInfo.html('');
|
||||
this.verifyMatch.attr('href', this.verifyMatchBaseHref);
|
||||
this.button.val('Create ' + this.baseButtonText)
|
||||
|
||||
if (this.formSteps > 1) {
|
||||
this.acSelection.find('label').html('Selected ');
|
||||
}
|
||||
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue