updates to allow the property name to be included in autocomplete data property form- NIHVIVO-3386

This commit is contained in:
hjkhjk54 2012-01-27 22:24:15 +00:00
parent a38848b5b6
commit 0bc09b07a6
2 changed files with 10 additions and 6 deletions

View file

@ -7,7 +7,7 @@
<#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter /> <#assign sparqlForAcFilter = editConfiguration.pageData.sparqlForAcFilter />
<#assign editMode = editConfiguration.pageData.editMode /> <#assign editMode = editConfiguration.pageData.editMode />
<#assign propertyPublicName = editConfiguration.propertyPublicName/>
<h2>${editConfiguration.formTitle}</h2> <h2>${editConfiguration.formTitle}</h2>
<#--Display error messages if any--> <#--Display error messages if any-->
@ -66,10 +66,9 @@ Also multiple types parameter set to true only if more than one type returned-->
property: '${editConfiguration.predicateUri}', property: '${editConfiguration.predicateUri}',
submitButtonTextType: 'simple', submitButtonTextType: 'simple',
editMode: '${editMode}', //Change this to check whether adding or editing editMode: '${editMode}', //Change this to check whether adding or editing
supportEdit: 'true',
sparqlForAcFilter: '${sparqlForAcFilter}', sparqlForAcFilter: '${sparqlForAcFilter}',
sparqlQueryUrl: '${sparqlQueryUrl}', sparqlQueryUrl: '${sparqlQueryUrl}',
defaultTypeName: 'string' defaultTypeName: '${propertyPublicName}'
}; };
</script> </script>

View file

@ -363,7 +363,7 @@ var customForm = {
// Set field labels based on type selection. Although these won't change in edit // Set field labels based on type selection. Although these won't change in edit
// mode, it's easier to specify the text here than in the jsp. // mode, it's easier to specify the text here than in the jsp.
setLabels: function() { setLabels: function() {
var typeName = "string"; var typeName = this.defaultTypeName;
this.labelsWithPlaceholders.each(function() { this.labelsWithPlaceholders.each(function() {
var newLabel = $(this).data('baseText').replace(customForm.placeholderText, typeName); var newLabel = $(this).data('baseText').replace(customForm.placeholderText, typeName);
@ -375,7 +375,11 @@ var customForm = {
// Set button text based on both type selection and whether it's an autocomplete selection // Set button text based on both type selection and whether it's an autocomplete selection
// or a new related individual. Called when setting up full view of form, and after // or a new related individual. Called when setting up full view of form, and after
// an autocomplete selection. // an autocomplete selection.
//Commenting out for now because keeping in synch with regular data property form and
//not changing the button text at all
setButtonText: function(newOrExisting) { setButtonText: function(newOrExisting) {
/*
var typeText, var typeText,
buttonText, buttonText,
baseButtonText = this.button.data('baseText'); baseButtonText = this.button.data('baseText');
@ -385,7 +389,7 @@ var customForm = {
return; return;
} }
typeText = "string"; typeText = this.defaultTypeName;
// Creating new related individual // Creating new related individual
if (newOrExisting === 'new') { if (newOrExisting === 'new') {
@ -405,12 +409,13 @@ var customForm = {
} }
this.button.val(buttonText); this.button.val(buttonText);
*/
}, },
// Set the initial help text that appears in the autocomplete field and change the class name // Set the initial help text that appears in the autocomplete field and change the class name
addAcHelpText: function() { addAcHelpText: function() {
var typeText = "string"; var typeText = this.defaultTypeName;
// First case applies on page load; second case applies when the type gets changed. // First case applies on page load; second case applies when the type gets changed.
if (!this.acSelector.val() || this.acSelector.hasClass(this.acHelpTextClass)) { if (!this.acSelector.val() || this.acSelector.hasClass(this.acHelpTextClass)) {