NIHVIVO-193 Modifications for editing an existing position history entry
This commit is contained in:
parent
08544ebc33
commit
3891b1cf15
3 changed files with 45 additions and 33 deletions
|
@ -16,12 +16,14 @@
|
||||||
|
|
||||||
#addNewLink {
|
#addNewLink {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 18em;
|
/* This right margin works pretty well for both the add and edit version of the form.
|
||||||
|
Could customize for each of these versions later. */
|
||||||
|
margin-right: 15em;
|
||||||
margin-top: .8em;
|
margin-top: .8em;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
padding: .6em 0 .6em 1.5em;
|
padding: .6em 0 .6em 1.5em;
|
||||||
border: 1px solid #9c9c9c;
|
border: 1px solid #9c9c9c;
|
||||||
|
display: none; /* Hide if Javascript disabled. Javascript will show. */
|
||||||
}
|
}
|
||||||
|
|
||||||
#content form #existing {
|
#content form #existing {
|
||||||
|
@ -33,6 +35,7 @@
|
||||||
#new {
|
#new {
|
||||||
padding: .6em 0 .6em 1.5em;
|
padding: .6em 0 .6em 1.5em;
|
||||||
border: 1px solid #9c9c9c;
|
border: 1px solid #9c9c9c;
|
||||||
|
width: 70%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #content form p.inline span,*/
|
/* #content form p.inline span,*/
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
var customForm = {
|
var customForm = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
|
|
||||||
// Create references to form elements.
|
// Create references to form elements.
|
||||||
|
@ -32,16 +30,10 @@ var customForm = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Reset add form to initial state (step 1)
|
||||||
// Set up add form on page load, or when returning to initial state
|
// Should only be needed after returning to step 1 from step 2,
|
||||||
// (The latter is not yet implemented, but we are preparing for it. Note
|
// but sometimes seems to be needed on page load as well, so call it from initAddForm()
|
||||||
// that initializations to occur ONLY on page load are done in the onLoad() method.)
|
resetAddForm: function() {
|
||||||
// RY *** SOME of this will be shared with the edit form - figure out which
|
|
||||||
initAddForm: function() {
|
|
||||||
|
|
||||||
// Reset form to initial state
|
|
||||||
// Resetting should only need to be done after we've gone to step 2 and back to step 1,
|
|
||||||
// but for some reason it can be required on a page reload as well.
|
|
||||||
// Clear all form data and error messages
|
// Clear all form data and error messages
|
||||||
$('input:text').val('');
|
$('input:text').val('');
|
||||||
$('.error').text('');
|
$('.error').text('');
|
||||||
|
@ -50,11 +42,16 @@ var customForm = {
|
||||||
this.cancel.unbind('click');
|
this.cancel.unbind('click');
|
||||||
this.button.unbind('click');
|
this.button.unbind('click');
|
||||||
|
|
||||||
// RY Make toggleRequiredHints take multiple args
|
|
||||||
//this.toggleRequiredHints('remove', this.existing, this.addNew);
|
|
||||||
this.toggleRequiredHints('remove', this.addNew, this.existing);
|
this.toggleRequiredHints('remove', this.addNew, this.existing);
|
||||||
//this.toggleRequiredHints('remove', this.addNew);
|
},
|
||||||
// end reset
|
|
||||||
|
// Set up add form on page load, or when returning to initial state
|
||||||
|
// (The latter is not yet implemented, but we are preparing for it. Note
|
||||||
|
// that initializations to occur ONLY on page load are done in the onLoad() method.)
|
||||||
|
// RY *** SOME of this will be shared with the edit form - figure out which
|
||||||
|
initAddForm: function() {
|
||||||
|
|
||||||
|
this.resetAddForm();
|
||||||
|
|
||||||
// Step 1 of the form
|
// Step 1 of the form
|
||||||
this.addNewLink.show();
|
this.addNewLink.show();
|
||||||
|
@ -97,6 +94,21 @@ var customForm = {
|
||||||
|
|
||||||
initEditForm: function() {
|
initEditForm: function() {
|
||||||
|
|
||||||
|
this.showFields(this.existing);
|
||||||
|
this.addNewLink.show();
|
||||||
|
this.addNew.hide();
|
||||||
|
this.showFields(this.entry);
|
||||||
|
this.requiredLegend.show();
|
||||||
|
this.button.val('Save Changes');
|
||||||
|
|
||||||
|
this.addNewLink.bind('click', function() {
|
||||||
|
$(this).hide();
|
||||||
|
customForm.existing.hide();
|
||||||
|
customForm.showFields(customForm.addNew);
|
||||||
|
|
||||||
|
customForm.button.val('Create ' + customForm.newType + ' & Save Changes');
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add required hints to required fields in element array elArray.
|
// Add required hints to required fields in element array elArray.
|
||||||
|
|
|
@ -214,7 +214,7 @@
|
||||||
"objectClassUri" : "",
|
"objectClassUri" : "",
|
||||||
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
||||||
"rangeLang" : "",
|
"rangeLang" : "",
|
||||||
"assertions" : [ "${newOrgNameAssertion}" ]
|
"assertions" : [ "${n3ForNewOrg}" ]
|
||||||
},
|
},
|
||||||
"newOrgType" : {
|
"newOrgType" : {
|
||||||
"newResource" : "false",
|
"newResource" : "false",
|
||||||
|
@ -308,13 +308,10 @@
|
||||||
<h2>${title}</h2>
|
<h2>${title}</h2>
|
||||||
|
|
||||||
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||||
<c:if test="${editType == 'add'}">
|
|
||||||
|
|
||||||
<!-- Hide on initial load in case JavaScript turned off. -->
|
|
||||||
<div id="addNewLink">
|
<div id="addNewLink">
|
||||||
If your organization is not listed, please <a href="#">add a new organization</a>.
|
If your organization is not listed, please <a href="#">add a new organization</a>.
|
||||||
</div>
|
</div>
|
||||||
</c:if>
|
|
||||||
|
|
||||||
<div id="existing">
|
<div id="existing">
|
||||||
<v:input type="select" label="Organization" labelClass="required" id="organizationUri" />
|
<v:input type="select" label="Organization" labelClass="required" id="organizationUri" />
|
||||||
|
@ -335,7 +332,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- For Javascript -->
|
<!-- For Javascript -->
|
||||||
<input type="hidden" name="editType" value="add" />
|
<input type="hidden" name="editType" value="${editType}" />
|
||||||
<input type="hidden" name="entryType" value="position" />
|
<input type="hidden" name="entryType" value="position" />
|
||||||
<input type="hidden" name="newType" value="organization" />
|
<input type="hidden" name="newType" value="organization" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue