NIHVIVO-646 Move custom form utilities to a separate js file and add utility mixin methods to mix them in to specific custom forms. Make paths to css and js files in formPrefix.jsp and formSuffix.jsp absolute instead of relative.

This commit is contained in:
rjy7 2010-06-14 19:22:50 +00:00
parent c11d40a0f9
commit cc480a3961
5 changed files with 22 additions and 15 deletions

View file

@ -91,10 +91,10 @@ SPARQL queries for existing values. --%>
<v:jsonset var="authorshipRankAssertion"> <v:jsonset var="authorshipRankAssertion">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
?authorshipUri core:authorRank ?rank ?authorshipUri core:authorRank ?rank .
</v:jsonset> </v:jsonset>
<%-- This much applies to both new and existing person --%> <%-- This applies to both new and existing person --%>
<v:jsonset var="n3ForNewAuthorship"> <v:jsonset var="n3ForNewAuthorship">
@prefix core: <${vivoCore}> . @prefix core: <${vivoCore}> .
@ -225,11 +225,14 @@ SPARQL queries for existing values. --%>
String linkedAuthorProperty = "http://vivoweb.org/ontology/core#linkedAuthor"; String linkedAuthorProperty = "http://vivoweb.org/ontology/core#linkedAuthor";
List<String> customJs = new ArrayList<String>(Arrays.asList("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); request.setAttribute("customJs", customJs);
List<String> customCss = new ArrayList<String>(Arrays.asList("forms/css/customForm.css", List<String> customCss = new ArrayList<String>(Arrays.asList("/edit/forms/css/customForm.css",
"forms/css/addAuthorsToInformationResource.css" "/edit/forms/css/addAuthorsToInformationResource.css"
)); ));
request.setAttribute("customCss", customCss); request.setAttribute("customCss", customCss);
%> %>

View file

@ -34,6 +34,9 @@ var addAuthorForm = {
initForm: function() { initForm: function() {
// Mix in the custom form utility methods
vitro.utils.borrowMethods(vitro.customFormUtils, this);
this.showFormButton.click(function() { this.showFormButton.click(function() {
addAuthorForm.showFormDiv.hide(); addAuthorForm.showFormDiv.hide();
addAuthorForm.form.show(); addAuthorForm.form.show();
@ -41,7 +44,7 @@ var addAuthorForm = {
}); });
this.cancel.click(function() { this.cancel.click(function() {
addAuthorForm.form.hide(); addAuthorForm.hideFields(addAuthorForm.form);
addAuthorForm.showFormDiv.show(); addAuthorForm.showFormDiv.show();
return false; return false;
}); });
@ -51,6 +54,7 @@ var addAuthorForm = {
// when clicking remove: remove the author, and change link text to "undo" // 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" // when clicking undo: add the author back, and change link text to "remove"
} }
} }
$(document).ready(function() { $(document).ready(function() {

View file

@ -289,7 +289,7 @@
<% } <% }
List<String> customCss = new ArrayList<String>(Arrays.asList("forms/css/customForm.css" List<String> customCss = new ArrayList<String>(Arrays.asList("/edit/forms/css/customForm.css"
)); ));
request.setAttribute("customCss", customCss); request.setAttribute("customCss", customCss);
%> %>

View file

@ -364,13 +364,13 @@ the org type still gets asserted. --%>
<c:set var="submitLabel" value="Create New Educational Background" /> <c:set var="submitLabel" value="Create New Educational Background" />
<% } <% }
List<String> customJs = new ArrayList<String>(Arrays.asList("forms/js/customForm.js" List<String> customJs = new ArrayList<String>(Arrays.asList("/edit/forms/js/customForm.js"
//, "forms/js/customFormOneStep.js" //, "/edit/forms/js/customFormOneStep.js"
)); ));
request.setAttribute("customJs", customJs); request.setAttribute("customJs", customJs);
List<String> customCss = new ArrayList<String>(Arrays.asList("forms/css/customForm.css", List<String> customCss = new ArrayList<String>(Arrays.asList("/edit/forms/css/customForm.css",
"forms/css/personHasEducationalBackground.css" "/edit/forms/css/personHasEducationalBackground.css"
)); ));
request.setAttribute("customCss", customCss); request.setAttribute("customCss", customCss);
%> %>

View file

@ -295,13 +295,13 @@
<c:set var="submitLabel" value="Create position" /> <c:set var="submitLabel" value="Create position" />
<% } <% }
List<String> customJs = new ArrayList<String>(Arrays.asList("forms/js/customForm.js" List<String> customJs = new ArrayList<String>(Arrays.asList("/edit/forms/js/customForm.js"
//, "forms/js/customFormTwoStep.js" //, "/edit/forms/js/customFormTwoStep.js"
)); ));
request.setAttribute("customJs", customJs); request.setAttribute("customJs", customJs);
List<String> customCss = new ArrayList<String>(Arrays.asList("forms/css/customForm.css" List<String> customCss = new ArrayList<String>(Arrays.asList("/edit/forms/css/customForm.css"
, "forms/css/personHasPositionHistory.css" , "/edit/forms/css/personHasPositionHistory.css"
)); ));
request.setAttribute("customCss", customCss); request.setAttribute("customCss", customCss);
%> %>