NIHVIVO-646 Add cancelUrl parameter to submit tag in InputElementFormattingTags so that the cancel button can redirect to a different page from the form submission. Change cancel values in submit tags in vitro and vivo forms to "true" where previously they specified a uri, because the uri is misleading (it doesn't control the redirect location). Removed edit submission preprocessing due to problems with cloning.
This commit is contained in:
parent
bd45d55237
commit
13c57446dd
6 changed files with 60 additions and 14 deletions
|
@ -23,7 +23,15 @@ var addAuthorForm = {
|
|||
this.showFormDiv = $('#showAddForm');
|
||||
this.showFormButton = $('#showAddFormButton');
|
||||
this.removeLinks = $('a.remove');
|
||||
this.submit = this.form.find(':submit');
|
||||
this.cancel = this.form.find('.cancel');
|
||||
this.labelField = $('#label');
|
||||
this.firstNameField = $('#firstName');
|
||||
this.middleNameField = $('#middleName');
|
||||
this.lastNameField = $('#lastName');
|
||||
this.personUriField = $('#personUri');
|
||||
this.firstNameWrapper = this.firstNameField.parent();
|
||||
this.middleNameWrapper = this.middleNameField.parent();
|
||||
},
|
||||
|
||||
// On page load, make changes to the non-Javascript version for the Javascript version.
|
||||
|
@ -38,20 +46,28 @@ var addAuthorForm = {
|
|||
},
|
||||
|
||||
initForm: function() {
|
||||
|
||||
|
||||
//this.firstNameWrapper.hide();
|
||||
//this.middleNameWrapper.hide();
|
||||
|
||||
this.showFormButton.click(function() {
|
||||
addAuthorForm.showFormDiv.hide();
|
||||
addAuthorForm.form.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.submit.click(function() {
|
||||
addAuthorForm.insertLabel(); // might be insertLabelOrPersonUri
|
||||
});
|
||||
|
||||
this.cancel.click(function() {
|
||||
addAuthorForm.hideFields(addAuthorForm.form);
|
||||
addAuthorForm.showFormDiv.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
// this.setUpAutocomplete();
|
||||
|
||||
//this.setUpAutocomplete();
|
||||
},
|
||||
|
||||
// setUpAutocomplete: function() {
|
||||
|
@ -63,6 +79,32 @@ var addAuthorForm = {
|
|||
//
|
||||
// },
|
||||
|
||||
insertLabel: function() {
|
||||
var firstName,
|
||||
middleName,
|
||||
lastName,
|
||||
name;
|
||||
|
||||
if (!this.firstNameField.is(':hidden')) {
|
||||
firstName = this.firstNameField.val();
|
||||
middleName = this.middleNameField.val();
|
||||
lastName = this.lastNameField.val();
|
||||
|
||||
name = lastName;
|
||||
if (firstName) {
|
||||
name += ", " + firstName;
|
||||
}
|
||||
if (middleName) {
|
||||
name += " " + middleName;
|
||||
}
|
||||
|
||||
this.labelField.val(name);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
toggleRemoveLink: function() {
|
||||
// when clicking remove: remove the author, and change link text to "undo"
|
||||
// when clicking undo: add the author back, and change link text to "remove"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue