NIHVIVO-646 JS and CSS tweaks
This commit is contained in:
parent
5c9de606d0
commit
addabdc245
3 changed files with 34 additions and 19 deletions
|
@ -362,6 +362,13 @@ SPARQL queries for existing values. --%>
|
|||
<v:input type="submit" value="Add Author" id="showAddFormButton" cancel="true" cancelLabel="Return to Publication" cancelUrl="/individual" />
|
||||
</div>
|
||||
|
||||
<div id="infoForJs">
|
||||
<span class="rankPred" id="${rankPred}"></span>
|
||||
<span class="rankXsdType" id="${intDatatypeUri}"></span>
|
||||
<span class="acUrl" id="<c:url value="/autocomplete?type=${foaf}Person&stem=false" />"></span>
|
||||
<span class="reorderUrl" id="<c:url value="/edit/primitiveRdfEdit" />"></span>
|
||||
</div>
|
||||
|
||||
<form id="addAuthorForm" action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
||||
|
||||
<h3>Add an Author</h3>
|
||||
|
@ -377,11 +384,7 @@ SPARQL queries for existing values. --%>
|
|||
<input type="hidden" id="personUri" name="personUri" value="" /> <!-- Field value populated by JavaScript -->
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="rankPred" id="rankPred" value="${rankPred}" />
|
||||
<input type="hidden" name="rankXsdType" id="rankXsdType" value="${intDatatypeUri}" />
|
||||
<input type="hidden" name="rank" id="rank" value="${newRank}" />
|
||||
<input type="hidden" name="acUrl" id="acUrl" value="<c:url value="/autocomplete?type=${foaf}Person&stem=false" />" />
|
||||
<input type="hidden" name="reorderUrl" id="reorderUrl" value="<c:url value="/edit/primitiveRdfEdit" />" />
|
||||
|
||||
<p class="submit"><v:input type="submit" id="submit" value="Add Author" cancel="true" /></p>
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
margin-left: 2em;
|
||||
}
|
||||
|
||||
#infoForJs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
form h3 {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
@ -78,6 +82,15 @@ form a:hover.cancel,
|
|||
clear: left;
|
||||
}
|
||||
|
||||
#content form #selectedAuthor p.inline label {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
#selectedAuthorName {
|
||||
background-color: #d9d9d9;
|
||||
padding: .5em 1em;
|
||||
}
|
||||
|
||||
#content form p.submit {
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
|
|
@ -70,10 +70,9 @@ var addAuthorForm = {
|
|||
|
||||
this.submit.click(function() {
|
||||
// NB Important JavaScript scope issue: if we call it this way, this = addAuthorForm
|
||||
// in prepareFieldValuesForSubmit. If we do
|
||||
// this.submit.click(this.prepareFieldValuesForSubmit); then
|
||||
// this != addAuthorForm in prepareFieldValuesForSubmit.
|
||||
addAuthorForm.prepareFieldValuesForSubmit();
|
||||
// in prepareSubmit. If we do this.submit.click(prepareSubmit); then
|
||||
// this != addAuthorForm in prepareSubmit.
|
||||
addAuthorForm.prepareSubmit();
|
||||
});
|
||||
|
||||
this.lastNameField.blur(function() {
|
||||
|
@ -282,11 +281,11 @@ var addAuthorForm = {
|
|||
initAuthorReordering: function() {
|
||||
$('#authorships').sortable({
|
||||
stop: function(event, ui) {
|
||||
var predicateUri = '<' + $('#rankPred').val() + '>',
|
||||
rankXsdType = $('#rankXsdType').val(),
|
||||
additions = '',
|
||||
retractions = '',
|
||||
authorships = [];
|
||||
var predicateUri = '<' + $('.rankPred').attr('id') + '>',
|
||||
rankXsdType = $('.rankXsdType').attr('id'),
|
||||
additions = '',
|
||||
retractions = '',
|
||||
authorships = [];
|
||||
|
||||
$('li.authorship').each(function(index) {
|
||||
var uri = $(this).attr('id'),
|
||||
|
@ -324,7 +323,7 @@ var addAuthorForm = {
|
|||
// console.log("retractions: " + retractions);
|
||||
|
||||
$.ajax({
|
||||
url: $('#reorderUrl').val(),
|
||||
url: $('.reorderUrl').attr('id'),
|
||||
data: {
|
||||
additions: additions,
|
||||
retractions: retractions
|
||||
|
@ -333,7 +332,6 @@ var addAuthorForm = {
|
|||
processData: 'false',
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
movedItem: ui.item,
|
||||
success: function(data, status, request) {
|
||||
$.each(authorships, function(index, obj) {
|
||||
// find the element with this uri as id
|
||||
|
@ -377,7 +375,7 @@ var addAuthorForm = {
|
|||
initAutocomplete: function() {
|
||||
|
||||
var cache = {};
|
||||
var url = $('#acUrl').val();
|
||||
var url = $('.acUrl').attr('id');
|
||||
var existingAuthorUris = addAuthorForm.getExistingAuthorUris();
|
||||
|
||||
jQuery.each(existingAuthorUris, function(index, element) {
|
||||
|
@ -420,15 +418,16 @@ var addAuthorForm = {
|
|||
},
|
||||
|
||||
getExistingAuthorUris: function() {
|
||||
|
||||
var existingAuthors = $('#authorships li');
|
||||
// NB This only gets the id of the first one
|
||||
// return $('#authorships .authorLink').attr('id');
|
||||
var existingAuthors = $('#authorships .authorLink');
|
||||
return existingAuthors.map(function() {
|
||||
return $(this).attr('id');
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
prepareFieldValuesForSubmit: function() {
|
||||
prepareSubmit: function() {
|
||||
var firstName,
|
||||
middleName,
|
||||
lastName,
|
||||
|
|
Loading…
Add table
Reference in a new issue