Newer
Older
Sonia Zorba
committed
var restPath, windowId;
Sonia Zorba
committed
Sonia Zorba
committed
init: function (path, wid) {
Sonia Zorba
committed
restPath = path;
Sonia Zorba
committed
windowId = wid;
editClicked: function (event) {
if (event.status === 'success') {
$('#credentials-modal').modal('show');
}
},
credentialsSaved: function (event) {
if (event.status === 'success') {
if ($('#credentials-modal .text-danger').length === 0) {
$('#credentials-modal').modal('hide');
}
}
}
};
Sonia Zorba
committed
$(document).ready(function () {
$('body').on('shown.bs.modal', '#credentials-modal', function ( ) {
Sonia Zorba
committed
$.post(restPath + "/credentialsDialog?opened=true&dswid=" + windowId);
Sonia Zorba
committed
});
$('body').on('hidden.bs.modal', '#credentials-modal', function ( ) {
Sonia Zorba
committed
$.post(restPath + "/credentialsDialog?opened=false&dswid=" + windowId);
Sonia Zorba
committed
});
Sonia Zorba
committed
$('body').on('keyup', '#credentials-modal input', function (event) {
if (event.keyCode === 13) {
$('#main\\:save-credentials').click();
event.preventDefault();
}
})
Sonia Zorba
committed
});