Updates for NIHVIVO-3406 and NIHVIVO-3408 - the Vitro NewIndividualFormGenerator needed to be updated to add label to the set of fields (the code for creating the field was there but it wasn't assigned to the edit configuration object) and the freemarker template needed to be updated to include the correct name/id for the label field
This commit is contained in:
parent
3502db6219
commit
5d7f8486b8
2 changed files with 21 additions and 11 deletions
|
@ -204,8 +204,6 @@ public class NewIndividualFormGenerator implements EditConfigurationGenerator {
|
||||||
List<String> urisOnForm = new ArrayList<String>();
|
List<String> urisOnForm = new ArrayList<String>();
|
||||||
List<String> literalsOnForm = new ArrayList<String>();
|
List<String> literalsOnForm = new ArrayList<String>();
|
||||||
literalsOnForm.add("label");
|
literalsOnForm.add("label");
|
||||||
literalsOnForm.add("firstName");
|
|
||||||
literalsOnForm.add("lastName");
|
|
||||||
editConfiguration.setUrisOnform(urisOnForm);
|
editConfiguration.setUrisOnform(urisOnForm);
|
||||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||||
}
|
}
|
||||||
|
@ -237,11 +235,11 @@ public class NewIndividualFormGenerator implements EditConfigurationGenerator {
|
||||||
|
|
||||||
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) {
|
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) {
|
||||||
Map<String, FieldVTwo> fields = new HashMap<String, FieldVTwo>();
|
Map<String, FieldVTwo> fields = new HashMap<String, FieldVTwo>();
|
||||||
getLabelField(editConfiguration, vreq, fields);
|
setLabelField(editConfiguration, vreq, fields);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getLabelField(EditConfigurationVTwo editConfiguration,
|
private void setLabelField(EditConfigurationVTwo editConfiguration,
|
||||||
VitroRequest vreq, Map<String, FieldVTwo> fields) {
|
VitroRequest vreq, Map<String, FieldVTwo> fields) {
|
||||||
FieldVTwo field = new FieldVTwo();
|
FieldVTwo field = new FieldVTwo();
|
||||||
field.setName("label");
|
field.setName("label");
|
||||||
|
@ -264,6 +262,7 @@ public class NewIndividualFormGenerator implements EditConfigurationGenerator {
|
||||||
field.setLiteralOptions(new ArrayList<List<String>>());
|
field.setLiteralOptions(new ArrayList<List<String>>());
|
||||||
|
|
||||||
fields.put(field.getName(), field);
|
fields.put(field.getName(), field);
|
||||||
|
editConfiguration.setFields(fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,30 @@
|
||||||
<#--Retrieve certain edit configuration information-->
|
<#--Retrieve certain edit configuration information-->
|
||||||
<#assign typeName = editConfiguration.pageData.typeName />
|
<#assign typeName = editConfiguration.pageData.typeName />
|
||||||
|
|
||||||
|
<#--If edit submission exists, then retrieve validation errors if they exist-->
|
||||||
|
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
|
||||||
|
<#assign submissionErrors = editSubmission.validationErrors/>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
<h2>Create a new ${typeName}</h2>
|
<h2>Create a new ${typeName}</h2>
|
||||||
|
|
||||||
<#if errorNameFieldIsEmpty??>
|
<#if submissionErrors?has_content >
|
||||||
<#assign errorMessage = "Enter a name." />
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#if errorMessage?has_content>
|
|
||||||
<section id="error-alert" role="alert">
|
<section id="error-alert" role="alert">
|
||||||
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
|
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
|
||||||
<p>${errorMessage}</p>
|
<p>
|
||||||
|
<#list submissionErrors?keys as errorFieldName>
|
||||||
|
<#if errorFieldName == "label">
|
||||||
|
Please enter a value in the name field.
|
||||||
|
</#if>
|
||||||
|
<br />
|
||||||
|
</#list>
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||||
|
|
||||||
<section id="newIndividual" role="region">
|
<section id="newIndividual" role="region">
|
||||||
|
@ -26,7 +37,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="name">Name ${requiredHint}</label>
|
<label for="name">Name ${requiredHint}</label>
|
||||||
<input size="30" type="text" id="name" name="name" value="" />
|
<input size="30" type="text" id="label" name="label" value="" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue