Merging r914 through r916 from rel-1.1-maint
This commit is contained in:
parent
6f94c047ef
commit
c06384d6c2
5 changed files with 79 additions and 33 deletions
|
@ -34,7 +34,8 @@ var customForm = {
|
|||
this.acSelector = this.form.find('.acSelector');
|
||||
this.acSelection = this.form.find('.acSelection');
|
||||
this.acSelectionInfo = this.form.find('.acSelectionInfo');
|
||||
this.acReceiver = this.form.find('.acReceiver');
|
||||
this.acUriReceiver = this.form.find('.acUriReceiver');
|
||||
this.acLabelReceiver = this.form.find('.acLabelReceiver');
|
||||
this.verifyMatch = this.form.find('.verifyMatch');
|
||||
this.verifyMatchBaseHref = this.verifyMatch.attr('href');
|
||||
this.acSelectorWrapper = this.acSelector.parent();
|
||||
|
@ -85,14 +86,16 @@ var customForm = {
|
|||
initFormView: function() {
|
||||
|
||||
var typeVal = this.typeSelector.val();
|
||||
|
||||
if (this.formSteps == 1 || this.findValidationErrors()) {
|
||||
this.initFormFullView();
|
||||
|
||||
if (this.findValidationErrors()) {
|
||||
this.initFormWithValidationErrors();
|
||||
//this.initFormFullView();
|
||||
}
|
||||
// this.formSteps == 1 includes edit mode.
|
||||
// If type is already selected when the page loads (Firefox retains value
|
||||
// on a refresh), go directly to full view. Otherwise user has to reselect
|
||||
// twice to get to full view.
|
||||
else if (typeVal.length) {
|
||||
// twice to get to full view.
|
||||
else if ( this.formSteps == 1 || typeVal.length ) {
|
||||
this.initFormFullView();
|
||||
}
|
||||
else {
|
||||
|
@ -123,10 +126,10 @@ var customForm = {
|
|||
this.requiredLegend.show();
|
||||
this.button.show();
|
||||
this.setButtonText('new');
|
||||
this.setLabels();
|
||||
this.cancel.unbind('click');
|
||||
this.setLabels();
|
||||
|
||||
if( this.formSteps > 1 ){
|
||||
if( this.formSteps > 1 ){ // NB includes this.editMode == 1
|
||||
this.cancel.unbind('click');
|
||||
this.cancel.click(function() {
|
||||
customForm.clearFormData(); // clear any input and validation errors
|
||||
customForm.initFormTypeView();
|
||||
|
@ -135,8 +138,31 @@ var customForm = {
|
|||
}
|
||||
},
|
||||
|
||||
initFormWithValidationErrors: function() {
|
||||
var uri = this.acUriReceiver.val(),
|
||||
label = this.acLabelReceiver.val();
|
||||
|
||||
// Call initFormFullView first, because showAutocompleteSelection needs
|
||||
// acType, which is set in initFormFullView.
|
||||
this.initFormFullView();
|
||||
|
||||
if (uri) {
|
||||
this.showAutocompleteSelection(label, uri);
|
||||
}
|
||||
|
||||
this.cancel.unbind('click');
|
||||
this.cancel.click(function() {
|
||||
// Cancel back to full view with only type selection showing
|
||||
customForm.undoAutocompleteSelection();
|
||||
customForm.clearFields(customForm.fullViewOnly);
|
||||
customForm.initFormFullView();
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
initFormEditView: function() {
|
||||
// These should not be editable: only properties of the role are editable.
|
||||
// These are not editable: only properties of the role are editable.
|
||||
this.typeSelector.attr('disabled', 'disabled');
|
||||
this.relatedIndLabel.attr('disabled', 'disabled');
|
||||
|
||||
|
@ -148,7 +174,8 @@ var customForm = {
|
|||
});
|
||||
},
|
||||
|
||||
// Bind event listeners that persist over the life of the page.
|
||||
// Bind event listeners that persist over the life of the page. Event listeners
|
||||
// that depend on the view should be initialized in the view setup method.
|
||||
bindEventListeners: function() {
|
||||
|
||||
this.typeSelector.change(function() {
|
||||
|
@ -206,7 +233,7 @@ var customForm = {
|
|||
});
|
||||
},
|
||||
select: function(event, ui) {
|
||||
customForm.showAutocompleteSelection(ui);
|
||||
customForm.showAutocompleteSelection(ui.item.label, ui.item.uri);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -280,10 +307,8 @@ var customForm = {
|
|||
this.acCache = {};
|
||||
},
|
||||
|
||||
showAutocompleteSelection: function(ui) {
|
||||
|
||||
var uri = ui.item.uri;
|
||||
|
||||
showAutocompleteSelection: function(label, uri) {
|
||||
|
||||
this.acSelectorWrapper.hide();
|
||||
this.acSelector.attr('disabled', 'disabled');
|
||||
|
||||
|
@ -294,8 +319,9 @@ var customForm = {
|
|||
|
||||
this.acSelection.show();
|
||||
|
||||
this.acReceiver.val(uri);
|
||||
this.acSelectionInfo.html(ui.item.label);
|
||||
this.acUriReceiver.val(uri);
|
||||
this.acLabelReceiver.val(label);
|
||||
this.acSelectionInfo.html(label);
|
||||
this.verifyMatch.attr('href', this.verifyMatchBaseHref + uri);
|
||||
|
||||
this.setButtonText('existing');
|
||||
|
@ -316,7 +342,7 @@ var customForm = {
|
|||
this.acSelector.attr('disabled', '');
|
||||
this.acSelector.val('');
|
||||
this.hideFields(this.acSelection);
|
||||
this.acReceiver.val('');
|
||||
this.acUriReceiver.val('');
|
||||
this.acSelectionInfo.html('');
|
||||
this.verifyMatch.attr('href', this.verifyMatchBaseHref);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue