NIHVIVO-646 Continued work on custom form for adding authors to publications
This commit is contained in:
parent
bfcd18096a
commit
c11d40a0f9
3 changed files with 46 additions and 19 deletions
|
@ -214,7 +214,6 @@ SPARQL queries for existing values. --%>
|
|||
|
||||
Model model = (Model) application.getAttribute("jenaOntModel");
|
||||
String objectUri = (String) request.getAttribute("objectUri");
|
||||
System.out.println("OBJECT URI: " + objectUri);
|
||||
editConfig.prepareForNonUpdate(model); // we're only adding new, not editing existing
|
||||
|
||||
String subjectUri = vreq.getParameter("subjectUri");
|
||||
|
@ -242,17 +241,19 @@ SPARQL queries for existing values. --%>
|
|||
<jsp:include page="${preForm}" />
|
||||
|
||||
<h2>${title}</h2>
|
||||
|
||||
<ul class="authors">
|
||||
|
||||
<ul id="authors">
|
||||
<%
|
||||
for ( Individual authorship : authorships ) {
|
||||
List<Individual> authors = authorship.getRelatedIndividuals(linkedAuthorProperty);
|
||||
if ( !authors.isEmpty() ) {
|
||||
Individual author = authors.get(0);
|
||||
String authorName = getAuthorName(author);
|
||||
Individual author = authorship.getRelatedIndividual(linkedAuthorProperty);
|
||||
if ( author != null ) {
|
||||
request.setAttribute("author", author);
|
||||
%>
|
||||
|
||||
<li><span class="authorName"><%= authorName %></span><a href="" class="remove">Remove</a></li>
|
||||
<%-- RY Should use author short view here? --%>
|
||||
<c:url var="authorHref" value="/individual">
|
||||
<c:param name="uri" value="${author.URI}"/>
|
||||
</c:url>
|
||||
<li><a href="${authorHref}" class="authorName"><%= getAuthorName(author) %></a><a href="" class="remove">Remove</a></li>
|
||||
|
||||
<%
|
||||
}
|
||||
|
@ -261,7 +262,10 @@ SPARQL queries for existing values. --%>
|
|||
|
||||
</ul>
|
||||
|
||||
<input type="button" value="Add Author" id="showAddForm" />
|
||||
<div id="showAddForm">
|
||||
<v:input type="submit" value="Add Author" id="showAddFormButton" cancel="${param.subjectUri}" cancelLabel="Done" />
|
||||
</div>
|
||||
|
||||
|
||||
<form id="addAuthorForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||
|
||||
|
@ -272,7 +276,7 @@ SPARQL queries for existing values. --%>
|
|||
<input type="hidden" name="personUri" value="" />
|
||||
<input type="hidden" name="rank" value="${rank}" />
|
||||
|
||||
<p class="submit"><v:input type="submit" id="submit" value="Add Author" cancel="${param.subjectUri}"/></p>
|
||||
<p class="submit"><v:input type="submit" id="submit" value="Add Author" cancel="${param.subjectUri}" /></p>
|
||||
|
||||
<p id="requiredLegend" class="requiredHint">* required fields</p>
|
||||
</form>
|
||||
|
|
|
@ -1,25 +1,39 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
ul.authors {
|
||||
#authors {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
ul.authors li {
|
||||
#authors li {
|
||||
list-style: none;
|
||||
margin-bottom: .75em;
|
||||
}
|
||||
|
||||
ul.authors span.authorName {
|
||||
#authors a.authorName {
|
||||
display: inline-block;
|
||||
width: 15em;
|
||||
}
|
||||
|
||||
/* Hide elements not used in non-JS version of form */
|
||||
#showFormButton,
|
||||
#showAddForm,
|
||||
a.remove {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form a:link.cancel, form a:visited.cancel,
|
||||
#authors a:link.remove, #authors a:visited.remove,
|
||||
#showAddForm a:link.cancel, #showAddForm a:visited.cancel {
|
||||
color: #f70;
|
||||
border-color: #f70;
|
||||
}
|
||||
|
||||
form a:hover.cancel,
|
||||
#authors a:hover.remove,
|
||||
#showAddForm a:hover.cancel {
|
||||
color: #fff;
|
||||
background: #f70;
|
||||
}
|
||||
|
||||
#content form p.inline {
|
||||
clear: left;
|
||||
margin-bottom: 0;
|
||||
|
|
|
@ -15,8 +15,10 @@ var addAuthorForm = {
|
|||
initObjects: function() {
|
||||
|
||||
this.form = $('#addAuthorForm');
|
||||
this.showFormButton = $('#showAddForm');
|
||||
this.showFormDiv = $('#showAddForm');
|
||||
this.showFormButton = $('#showAddFormButton');
|
||||
this.removeLinks = $('a.remove');
|
||||
this.cancel = this.form.find('.cancel');
|
||||
},
|
||||
|
||||
// On page load, make changes to the non-Javascript version for the Javascript version.
|
||||
|
@ -24,7 +26,7 @@ var addAuthorForm = {
|
|||
adjustForJs: function() {
|
||||
|
||||
// Show elements that are hidden by css on load since not used in non-JS version
|
||||
this.showFormButton.show();
|
||||
this.showFormDiv.show();
|
||||
this.removeLinks.show();
|
||||
|
||||
this.form.hide();
|
||||
|
@ -32,9 +34,16 @@ var addAuthorForm = {
|
|||
|
||||
initForm: function() {
|
||||
|
||||
this.showFormButton.bind('click', function() {
|
||||
$(this).hide();
|
||||
this.showFormButton.click(function() {
|
||||
addAuthorForm.showFormDiv.hide();
|
||||
addAuthorForm.form.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.cancel.click(function() {
|
||||
addAuthorForm.form.hide();
|
||||
addAuthorForm.showFormDiv.show();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue