NIHVIVO-753 Undo toggling of last name field label, and javascript name-fixing. See discussion under NIHVIVO-444 for the rationale behind these changes.

NIHVIVO-725 More work on publication form.
This commit is contained in:
rjy7 2010-07-07 14:57:20 +00:00
parent 98543e75e0
commit 7685f5e329
5 changed files with 25 additions and 28 deletions

View file

@ -398,7 +398,7 @@ SPARQL queries for existing values. --%>
<h3>Add an Author</h3> <h3>Add an Author</h3>
<p class="inline"><v:input type="text" id="lastName" label="Name ${requiredHint}" cssClass="acInput" size="30" /></p> <p class="inline"><v:input type="text" id="lastName" label="Last name ${requiredHint}" cssClass="acInput" size="30" /></p>
<p class="inline"><v:input type="text" id="firstName" label="First name ${requiredHint} ${initialHint}" size="20" /></p> <p class="inline"><v:input type="text" id="firstName" label="First name ${requiredHint} ${initialHint}" size="20" /></p>
<p class="inline"><v:input type="text" id="middleName" label="Middle name ${initialHint}" size="20" /></p> <p class="inline"><v:input type="text" id="middleName" label="Middle name ${initialHint}" size="20" /></p>
<input type="hidden" id="label" name="label" value="" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="label" name="label" value="" /> <!-- Field value populated by JavaScript -->

View file

@ -220,12 +220,12 @@ SPARQL queries for existing values. --%>
<v:input type="select" label="Publication type" id="pubType" /> <v:input type="select" label="Publication type" id="pubType" />
<v:input type="text" id="title" label="title" cssClass="acInput" size="50" /> <v:input type="text" id="title" label="title" cssClass="acInput newIndLabel" size="50" />
<div class="acSelection"> <div class="acSelection">
<%-- RY maybe make this a label and input field. See what looks best. --%> <%-- RY maybe make this a label and input field. See what looks best. --%>
<p class="inline"><label>Selected :</label><span class="acSelectionName"></span></p> <p class="inline"><label>Selected :</label><span class="acSelectionName"></span></p>
<input type="hidden" id="pubUri" name="pubUri" value="" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="pubUri" name="pubUri" cssClass="existingIndUri" value="" /> <!-- Field value populated by JavaScript -->
</div> </div>
<p class="submit"><v:input type="submit" id="submit" value="Create Publication" cancel="true" /></p> <p class="submit"><v:input type="submit" id="submit" value="Create Publication" cancel="true" /></p>

View file

@ -1,5 +1 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
#selectedResource {
display:none;
}

View file

@ -130,20 +130,20 @@ var addAuthorForm = {
showFieldsForNewPerson: function() { showFieldsForNewPerson: function() {
this.firstNameWrapper.show(); this.firstNameWrapper.show();
this.middleNameWrapper.show(); this.middleNameWrapper.show();
this.toggleLastNameLabel('Name', 'Last name'); // this.toggleLastNameLabel('Name', 'Last name');
}, },
hideFieldsForNewPerson: function() { hideFieldsForNewPerson: function() {
this.hideFields(this.firstNameWrapper); this.hideFields(this.firstNameWrapper);
this.hideFields(this.middleNameWrapper); this.hideFields(this.middleNameWrapper);
this.toggleLastNameLabel('Last name', 'Name'); // this.toggleLastNameLabel('Last name', 'Name');
}, },
toggleLastNameLabel: function(currentText, newText) { // toggleLastNameLabel: function(currentText, newText) {
var lastNameLabelText = this.lastNameLabel.html(), // var lastNameLabelText = this.lastNameLabel.html(),
newLastNameLabelText = lastNameLabelText.replace(currentText, newText); // newLastNameLabelText = lastNameLabelText.replace(currentText, newText);
this.lastNameLabel.html(newLastNameLabelText); // this.lastNameLabel.html(newLastNameLabelText);
}, // },
/* *** Ajax initializations *** */ /* *** Ajax initializations *** */
@ -451,24 +451,26 @@ var addAuthorForm = {
onLastNameChange: function() { onLastNameChange: function() {
this.showFieldsForNewPerson(); this.showFieldsForNewPerson();
this.firstNameField.focus(); this.firstNameField.focus();
this.fixNames(); // this.fixNames();
}, },
// User may have typed first name as well as last name into last name field. // User may have typed first name as well as last name into last name field.
// If so, when showing first and middle name fields, move anything after a comma // If so, when showing first and middle name fields, move anything after a comma
// or space into the first name field. // or space into the first name field.
fixNames: function() { // RY Space is problematic because they may be entering "<firstname> <lastname>", but
var lastNameInput = this.lastNameField.val(), // comma is a clear case.
names = lastNameInput.split(/[, ]+/), // fixNames: function() {
lastName = names[0]; // var lastNameInput = this.lastNameField.val(),
// names = lastNameInput.split(/[, ]+/),
this.lastNameField.val(lastName); // lastName = names[0];
//
if (names.length > 1) { // this.lastNameField.val(lastName);
//firstName = names[1].replace(/^[, ]+/, ''); //
this.firstNameField.val(names[1]); // if (names.length > 1) {
} // //firstName = names[1].replace(/^[, ]+/, '');
}, // this.firstNameField.val(names[1]);
// }
// },
removeAuthorship: function(link) { removeAuthorship: function(link) {
// RY Upgrade this to a modal window // RY Upgrade this to a modal window

View file

@ -1,3 +1,2 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
$('#pubUri').attr('disabled', 'disabled');