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 {
|
||||
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;
|
||||
width: 30%;
|
||||
padding: .6em 0 .6em 1.5em;
|
||||
border: 1px solid #9c9c9c;
|
||||
|
||||
display: none; /* Hide if Javascript disabled. Javascript will show. */
|
||||
}
|
||||
|
||||
#content form #existing {
|
||||
|
@ -33,6 +35,7 @@
|
|||
#new {
|
||||
padding: .6em 0 .6em 1.5em;
|
||||
border: 1px solid #9c9c9c;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
/* #content form p.inline span,*/
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
var customForm = {
|
||||
|
||||
|
||||
|
||||
onLoad: function() {
|
||||
|
||||
// Create references to form elements.
|
||||
|
@ -25,13 +23,27 @@ var customForm = {
|
|||
this.newType = $("input[name='newType']").val().capitalize();
|
||||
|
||||
if (this.editType == 'add') { //adding a new entry
|
||||
this.initAddForm();
|
||||
|
||||
this.initAddForm();
|
||||
|
||||
} else { // editing existing entry
|
||||
this.initEditForm();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Reset add form to initial state (step 1)
|
||||
// Should only be needed after returning to step 1 from step 2,
|
||||
// but sometimes seems to be needed on page load as well, so call it from initAddForm()
|
||||
resetAddForm: function() {
|
||||
// Clear all form data and error messages
|
||||
$('input:text').val('');
|
||||
$('.error').text('');
|
||||
|
||||
// Remove previously bound event handlers
|
||||
this.cancel.unbind('click');
|
||||
this.button.unbind('click');
|
||||
|
||||
this.toggleRequiredHints('remove', this.addNew, this.existing);
|
||||
},
|
||||
|
||||
// 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
|
||||
|
@ -39,22 +51,7 @@ var customForm = {
|
|||
// 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
|
||||
$('input:text').val('');
|
||||
$('.error').text('');
|
||||
|
||||
// Remove previously bound event handlers
|
||||
this.cancel.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);
|
||||
// end reset
|
||||
this.resetAddForm();
|
||||
|
||||
// Step 1 of the form
|
||||
this.addNewLink.show();
|
||||
|
@ -96,7 +93,22 @@ var customForm = {
|
|||
},
|
||||
|
||||
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.
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
"objectClassUri" : "",
|
||||
"rangeDatatypeUri" : "${stringDatatypeUriJson}",
|
||||
"rangeLang" : "",
|
||||
"assertions" : [ "${newOrgNameAssertion}" ]
|
||||
"assertions" : [ "${n3ForNewOrg}" ]
|
||||
},
|
||||
"newOrgType" : {
|
||||
"newResource" : "false",
|
||||
|
@ -308,13 +308,10 @@
|
|||
<h2>${title}</h2>
|
||||
|
||||
<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">
|
||||
If your organization is not listed, please <a href="#">add a new organization</a>.
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<div id="addNewLink">
|
||||
If your organization is not listed, please <a href="#">add a new organization</a>.
|
||||
</div>
|
||||
|
||||
<div id="existing">
|
||||
<v:input type="select" label="Organization" labelClass="required" id="organizationUri" />
|
||||
|
@ -335,7 +332,7 @@
|
|||
</div>
|
||||
|
||||
<!-- 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="newType" value="organization" />
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue