Add custom form utils mixin to forms for educational background and position history.
This commit is contained in:
parent
cc480a3961
commit
ab3e088cdf
5 changed files with 23 additions and 33 deletions
|
@ -225,10 +225,10 @@ SPARQL queries for existing values. --%>
|
|||
|
||||
String linkedAuthorProperty = "http://vivoweb.org/ontology/core#linkedAuthor";
|
||||
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList(
|
||||
"/js/utils.js",
|
||||
"/js/customFormUtils.js",
|
||||
"/edit/forms/js/addAuthorsToInformationResource.js"));
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList("/js/utils.js",
|
||||
"/js/customFormUtils.js",
|
||||
"/edit/forms/js/addAuthorsToInformationResource.js"
|
||||
));
|
||||
request.setAttribute("customJs", customJs);
|
||||
|
||||
List<String> customCss = new ArrayList<String>(Arrays.asList("/edit/forms/css/customForm.css",
|
||||
|
|
|
@ -4,11 +4,16 @@ var addAuthorForm = {
|
|||
|
||||
onLoad: function() {
|
||||
|
||||
this.mixIn();
|
||||
this.initObjects();
|
||||
this.adjustForJs();
|
||||
this.initForm();
|
||||
},
|
||||
|
||||
mixIn: function() {
|
||||
// Mix in the custom form utility methods
|
||||
vitro.utils.borrowMethods(vitro.customFormUtils, this);
|
||||
},
|
||||
|
||||
// On page load, create references within the customForm scope to DOM elements.
|
||||
// NB These must be assigned after the elements have been loaded onto the page.
|
||||
|
@ -34,8 +39,7 @@ var addAuthorForm = {
|
|||
|
||||
initForm: function() {
|
||||
|
||||
// Mix in the custom form utility methods
|
||||
vitro.utils.borrowMethods(vitro.customFormUtils, this);
|
||||
|
||||
|
||||
this.showFormButton.click(function() {
|
||||
addAuthorForm.showFormDiv.hide();
|
||||
|
|
|
@ -57,11 +57,17 @@ var customForm = {
|
|||
|
||||
onLoad: function() {
|
||||
|
||||
this.mixIn();
|
||||
this.initObjects();
|
||||
this.adjustForJs();
|
||||
this.initForm();
|
||||
},
|
||||
|
||||
mixIn: function() {
|
||||
// Mix in the custom form utility methods
|
||||
vitro.utils.borrowMethods(vitro.customFormUtils, this);
|
||||
},
|
||||
|
||||
// On page load, create references within the customForm scope to DOM elements.
|
||||
// NB These must be assigned after the elements have been loaded onto the page.
|
||||
initObjects: function() {
|
||||
|
@ -285,8 +291,6 @@ var customForm = {
|
|||
this.setReturnView(this.views.COMBINED);
|
||||
},
|
||||
|
||||
/***** Utilities *****/
|
||||
|
||||
unbindEventListeners: function() {
|
||||
customForm.cancel.unbind('click');
|
||||
customForm.button.unbind('click');
|
||||
|
@ -295,28 +299,6 @@ var customForm = {
|
|||
customForm.existingSelect.unbind('change');
|
||||
},
|
||||
|
||||
clearFormData: function() {
|
||||
customForm.clearFields(customForm.form);
|
||||
},
|
||||
|
||||
// Clear data from form elements in element el
|
||||
clearFields: function(el) {
|
||||
el.find(':input[type!="hidden"][type!="submit"][type!="button"]').val('');
|
||||
|
||||
// For now we can remove the error elements. Later we may include them in
|
||||
// the markup, for customized positioning, in which case we will empty them
|
||||
// but not remove them here. See findValidationErrors().
|
||||
el.find('.validationError').remove();
|
||||
},
|
||||
|
||||
// This method should always be called instead of calling hide() directly on any
|
||||
// element containing form fields.
|
||||
hideFields: function(el) {
|
||||
// Clear any input and error message, so if we re-show the element it won't still be there.
|
||||
customForm.clearFields(el);
|
||||
el.hide();
|
||||
},
|
||||
|
||||
// Add event listener to the submit button in step 2
|
||||
doButtonForStep2: function(text) {
|
||||
customForm.button.unbind('click');
|
||||
|
|
|
@ -364,7 +364,9 @@ the org type still gets asserted. --%>
|
|||
<c:set var="submitLabel" value="Create New Educational Background" />
|
||||
<% }
|
||||
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList("/edit/forms/js/customForm.js"
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList("/js/utils.js",
|
||||
"/js/customFormUtils.js",
|
||||
"/edit/forms/js/customForm.js"
|
||||
//, "/edit/forms/js/customFormOneStep.js"
|
||||
));
|
||||
request.setAttribute("customJs", customJs);
|
||||
|
|
|
@ -295,7 +295,9 @@
|
|||
<c:set var="submitLabel" value="Create position" />
|
||||
<% }
|
||||
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList("/edit/forms/js/customForm.js"
|
||||
List<String> customJs = new ArrayList<String>(Arrays.asList("/js/utils.js",
|
||||
"/js/customFormUtils.js",
|
||||
"/edit/forms/js/customForm.js"
|
||||
//, "/edit/forms/js/customFormTwoStep.js"
|
||||
));
|
||||
request.setAttribute("customJs", customJs);
|
||||
|
|
Loading…
Add table
Reference in a new issue