Skip to content
Snippets Groups Projects
Commit ee78ead2 authored by juanf's avatar juanf
Browse files

SSDM-3595 : Bugfix, suboptimal double click behavior

SVN: 36485
parent 8fd9ca45
No related merge requests found
...@@ -24,6 +24,8 @@ function CreateUserController() { ...@@ -24,6 +24,8 @@ function CreateUserController() {
this.createUser = function() { this.createUser = function() {
var _this = this; var _this = this;
this._createUserView.disableAccept();
var createUser = function() { var createUser = function() {
mainController.serverFacade.createELNUser(_this._createUserModel.userId, function(isRegistered, message) { mainController.serverFacade.createELNUser(_this._createUserModel.userId, function(isRegistered, message) {
if(isRegistered) { if(isRegistered) {
...@@ -31,10 +33,13 @@ function CreateUserController() { ...@@ -31,10 +33,13 @@ function CreateUserController() {
location.reload(); location.reload();
}); });
} else if (message.indexOf("Following persons already exist") !== -1){ } else if (message.indexOf("Following persons already exist") !== -1){
Util.showError(message); Util.showError(message, function() {
_this._createUserView.enableAccept();
}, true);
} else { } else {
_this._createUserView.showPasswordField(); _this._createUserView.showPasswordField();
_this._createUserModel.isPasswordRequired = true; _this._createUserModel.isPasswordRequired = true;
_this._createUserView.enableAccept();
} }
}); });
} }
...@@ -50,11 +55,13 @@ function CreateUserController() { ...@@ -50,11 +55,13 @@ function CreateUserController() {
if(isRegistered) { if(isRegistered) {
createUser(); createUser();
} else { } else {
Util.showError("User can't be created, check with your administator."); Util.showError("User can't be created, check with your administator.", function() {
_this._createUserView.enableAccept();
}, true);
} }
}); });
} else { } else {
Util.showError("Passwords are not equal.", function() {}, true); Util.showError("Passwords are not equal.", function() { _this._createUserView.enableAccept(); }, true);
} }
} }
......
...@@ -22,6 +22,15 @@ function CreateUserView(createUserController, createUserModel) { ...@@ -22,6 +22,15 @@ function CreateUserView(createUserController, createUserModel) {
this._passwordGroup = null; this._passwordGroup = null;
this._passFieldRepeat = null; this._passFieldRepeat = null;
this._passwordGroupRepeat = null; this._passwordGroupRepeat = null;
this._$btnAccept = $('<input>', { 'type': 'submit', 'class' : 'btn btn-primary', 'value' : 'Accept' });
this.disableAccept = function() {
this._$btnAccept.attr("disabled", "");
}
this.enableAccept = function() {
this._$btnAccept.removeAttr("disabled");
}
this.showPasswordField = function() { this.showPasswordField = function() {
this._passField.removeAttr('disabled'); this._passField.removeAttr('disabled');
...@@ -93,14 +102,12 @@ function CreateUserView(createUserController, createUserModel) { ...@@ -93,14 +102,12 @@ function CreateUserView(createUserController, createUserModel) {
// //
// Buttons // Buttons
// //
var $btnAccept = $('<input>', { 'type': 'submit', 'class' : 'btn btn-primary', 'value' : 'Accept' });
var $btnCancel = $('<a>', { 'class' : 'btn btn-default' }).append('Cancel'); var $btnCancel = $('<a>', { 'class' : 'btn btn-default' }).append('Cancel');
$btnCancel.click(function() { $btnCancel.click(function() {
Util.unblockUI(); Util.unblockUI();
}); });
$window.append($btnAccept).append('&nbsp;').append($btnCancel); $window.append(this._$btnAccept).append('&nbsp;').append($btnCancel);
var css = { var css = {
'text-align' : 'left', 'text-align' : 'left',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment