mirror of https://gitee.com/bigwinds/arangodb
Bug fix 3.3/modal event problems (#5203)
* fixed unreasonable event behaviour within the modal view * changelog * added esc event to properly hide and cleanup a modal
This commit is contained in:
parent
f14dc58187
commit
4f1b59fd5b
|
@ -1,6 +1,8 @@
|
|||
v3.3.9 (xxxx-xx-xx)
|
||||
-------------------
|
||||
|
||||
* UI: fixed an unreasonable event bug within the modal view engine
|
||||
|
||||
* fixed issue #3811: gharial api is now checking existence of _from and _to vertices
|
||||
during edge creation
|
||||
|
||||
|
|
|
@ -990,6 +990,7 @@
|
|||
this.waitForInit(this.installService.bind(this));
|
||||
return;
|
||||
}
|
||||
window.modalView.clearValidators();
|
||||
if (this.serviceInstallView) {
|
||||
this.serviceInstallView.remove();
|
||||
}
|
||||
|
@ -1006,6 +1007,7 @@
|
|||
this.waitForInit(this.installNewService.bind(this));
|
||||
return;
|
||||
}
|
||||
window.modalView.clearValidators();
|
||||
if (this.serviceNewView) {
|
||||
this.serviceNewView.remove();
|
||||
}
|
||||
|
@ -1021,6 +1023,7 @@
|
|||
this.waitForInit(this.installGitHubService.bind(this));
|
||||
return;
|
||||
}
|
||||
window.modalView.clearValidators();
|
||||
if (this.serviceGitHubView) {
|
||||
this.serviceGitHubView.remove();
|
||||
}
|
||||
|
@ -1036,6 +1039,7 @@
|
|||
this.waitForInit(this.installUrlService.bind(this));
|
||||
return;
|
||||
}
|
||||
window.modalView.clearValidators();
|
||||
if (this.serviceUrlView) {
|
||||
this.serviceUrlView.remove();
|
||||
}
|
||||
|
@ -1051,6 +1055,7 @@
|
|||
this.waitForInit(this.installUploadService.bind(this));
|
||||
return;
|
||||
}
|
||||
window.modalView.clearValidators();
|
||||
if (this.serviceUploadView) {
|
||||
this.serviceUploadView.remove();
|
||||
}
|
||||
|
|
|
@ -41,5 +41,14 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('keyup', function (e) {
|
||||
if (e.keyCode === 27) {
|
||||
if (window.modalView) {
|
||||
window.modalView.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}());
|
||||
|
|
|
@ -24,7 +24,15 @@
|
|||
},
|
||||
|
||||
events: {
|
||||
'click #installGitHubService': 'installGitHubService'
|
||||
'click #installGitHubService': 'installGitHubService',
|
||||
'keydown input': 'checkValidators'
|
||||
},
|
||||
|
||||
checkValidators: function () {
|
||||
if (window.modalView._validators.length !== 1) {
|
||||
window.modalView.clearValidators();
|
||||
this.setGithubValidators();
|
||||
}
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
|
|
@ -18,7 +18,15 @@
|
|||
},
|
||||
|
||||
events: {
|
||||
'click #installNewService': 'installNewService'
|
||||
'click #installNewService': 'installNewService',
|
||||
'keydown input': 'checkValidators'
|
||||
},
|
||||
|
||||
checkValidators: function () {
|
||||
if (window.modalView._validators.length !== 4) {
|
||||
window.modalView.clearValidators();
|
||||
this.setNewAppValidators();
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
|
@ -76,6 +84,10 @@
|
|||
window.modalView.hide();
|
||||
},
|
||||
|
||||
checkValidation: function () {
|
||||
window.modalView.modalTestAll();
|
||||
},
|
||||
|
||||
installCallback: function (result) {
|
||||
window.App.navigate('#services', {trigger: true});
|
||||
window.App.applicationsView.installCallback(result);
|
||||
|
|
|
@ -98,16 +98,20 @@
|
|||
$(this.el).unbind('keydown');
|
||||
$(this.el).unbind('return');
|
||||
|
||||
$('.modal-body .collectionTh > input').unbind('keydown');
|
||||
$('.modal-body .collectionTh > input').unbind('return');
|
||||
$('.modal-body .collectionTh > input', $(this.el)).bind('keydown', 'return', function (e) {
|
||||
$('.createModalDialog .modal-footer .button-success').click();
|
||||
$('#modal-dialog .modal-body .collectionTh > input').unbind('keydown');
|
||||
$('#modal-dialog .modal-body .collectionTh > input').unbind('return');
|
||||
$('#modal-dialog .modal-body .collectionTh > input', $(this.el)).bind('keydown', 'return', function () {
|
||||
if (!$('#modal-dialog .modal-footer .button-success').is(':disabled')) {
|
||||
$('#modal-dialog .modal-footer .button-success').click();
|
||||
}
|
||||
});
|
||||
|
||||
$('.modal-body .collectionTh > select').unbind('keydown');
|
||||
$('.modal-body .collectionTh > select').unbind('return');
|
||||
$('.modal-body .collectionTh > select', $(this.el)).bind('keydown', 'return', function (e) {
|
||||
$('.createModalDialog .modal-footer .button-success').click();
|
||||
$('#modal-dialog .modal-body .collectionTh > select').unbind('keydown');
|
||||
$('#modal-dialog .modal-body .collectionTh > select').unbind('return');
|
||||
$('#modal-dialog .modal-body .collectionTh > select', $(this.el)).bind('keydown', 'return', function () {
|
||||
if (!$('#modal-dialog .modal-footer .button-success').is(':disabled')) {
|
||||
$('#modal-dialog .modal-footer .button-success').click();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -503,9 +507,15 @@
|
|||
// error element not available
|
||||
$el.after('<p class="errorMessage">' + msg + '</p>');
|
||||
}
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
if ($('#modal-dialog').is(':visible')) {
|
||||
$('#modal-dialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
} else {
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
}
|
||||
} else {
|
||||
$el.removeClass('invalid-input');
|
||||
if (errorElement) {
|
||||
|
@ -525,13 +535,25 @@
|
|||
});
|
||||
var invalid = _.any(tests);
|
||||
if (invalid) {
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
if ($('#modal-dialog').is(':visible')) {
|
||||
$('#modal-dialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
} else {
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', true)
|
||||
.addClass('disabled');
|
||||
}
|
||||
} else {
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', false)
|
||||
.removeClass('disabled');
|
||||
if ($('#modal-dialog').is(':visible')) {
|
||||
$('#modal-dialog .modal-footer .button-success')
|
||||
.prop('disabled', false)
|
||||
.removeClass('disabled');
|
||||
} else {
|
||||
$('.createModalDialog .modal-footer .button-success')
|
||||
.prop('disabled', false)
|
||||
.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
return !invalid;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue