NIHVIVO-3397 fixed js timing issue with cancel button; also added verify this match, NIHVIVO-733

This commit is contained in:
tworrall 2011-12-02 15:51:05 +00:00
parent 88bc9eac68
commit 73a302b132
2 changed files with 24 additions and 5 deletions

View file

@ -60,6 +60,7 @@ var addAuthorForm = {
this.selectedAuthor = $('#selectedAuthor'); this.selectedAuthor = $('#selectedAuthor');
this.selectedAuthorName = $('#selectedAuthorName'); this.selectedAuthorName = $('#selectedAuthorName');
this.acHelpTextClass = 'acSelectorWithHelpText'; this.acHelpTextClass = 'acSelectorWithHelpText';
this.verifyMatch = this.form.find('.verifyMatch');
}, },
@ -78,6 +79,8 @@ var addAuthorForm = {
this.initAutocomplete(); this.initAutocomplete();
this.initElementData();
this.initAuthorDD(); this.initAuthorDD();
if (this.findValidationErrors()) { if (this.findValidationErrors()) {
@ -125,7 +128,9 @@ var addAuthorForm = {
this.initForm(); this.initForm();
this.hideFieldsForNewPerson(); // There's a conflict bewteen the last name fields .blur event and the cancel
// button's click. So display the middle and first names along with the last name tlw72
//this.hideFieldsForNewPerson();
// This shouldn't be needed, because calling this.hideFormFields(this.lastNameWrapper) // This shouldn't be needed, because calling this.hideFormFields(this.lastNameWrapper)
// from showSelectedAuthor should do it. However, it doesn't work from there, // from showSelectedAuthor should do it. However, it doesn't work from there,
@ -157,6 +162,7 @@ var addAuthorForm = {
// Reset the last name field. It had been hidden if we selected an author from // Reset the last name field. It had been hidden if we selected an author from
// the autocomplete field. // the autocomplete field.
this.lastNameWrapper.show(); this.lastNameWrapper.show();
this.showFieldsForNewPerson();
// Show the form // Show the form
this.form.show(); this.form.show();
@ -232,6 +238,10 @@ var addAuthorForm = {
}, },
initElementData: function() {
this.verifyMatch.data('baseHref', this.verifyMatch.attr('href'));
},
setAcFilter: function() { setAcFilter: function() {
this.acFilter = []; this.acFilter = [];
@ -293,6 +303,7 @@ var addAuthorForm = {
// since the keydown event on the last name field is also triggered (and // since the keydown event on the last name field is also triggered (and
// executes first). So re-hide them here. // executes first). So re-hide them here.
this.hideFieldsForNewPerson(); this.hideFieldsForNewPerson();
this.verifyMatch.attr('href', this.verifyMatch.data('baseHref') + ui.item.uri);
// Cancel restores initial form view // Cancel restores initial form view
this.cancel.unbind('click'); this.cancel.unbind('click');
@ -440,6 +451,11 @@ var addAuthorForm = {
addAuthorForm.onLastNameChange(); addAuthorForm.onLastNameChange();
}); });
this.verifyMatch.click(function() {
window.open($(this).attr('href'), 'verifyMatchWindow', 'width=640,height=640,scrollbars=yes,resizable=yes,status=yes,toolbar=no,menubar=no,location=no');
return false;
});
this.acSelector.focus(function() { this.acSelector.focus(function() {
addAuthorForm.deleteAcHelpText(); addAuthorForm.deleteAcHelpText();
}); });

View file

@ -125,10 +125,13 @@
<input type="hidden" id="label" name="label" value="" role="input" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="label" name="label" value="" role="input" /> <!-- Field value populated by JavaScript -->
<div id="selectedAuthor" class="acSelection"> <div id="selectedAuthor" class="acSelection">
<label>Selected author: </label><span class="acSelectionInfo" id="selectedAuthorName"></span></p> <p class="inline">
<label>Selected author:&nbsp;</label>
<span class="acSelectionInfo" id="selectedAuthorName"></span>
<a href="${urls.base}/individual?uri=" class="verifyMatch" title="verify match">(Verify this match)</a>
<input type="hidden" id="personUri" name="personUri" value="" role="input" /> <!-- Field value populated by JavaScript --> <input type="hidden" id="personUri" name="personUri" value="" role="input" /> <!-- Field value populated by JavaScript -->
</p>
</div> </div>
<input type="hidden" name="rank" id="rank" value="${newRank}" role="input" /> <input type="hidden" name="rank" id="rank" value="${newRank}" role="input" />
<p class="submit"> <p class="submit">