From: Marcin Haba Date: Wed, 30 Dec 2015 06:35:23 +0000 (+0100) Subject: baculum: Hide users input on ESC key press X-Git-Tag: Release-7.4.0~70 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0157f7fef6d57e91eddb48a3491e5004f07ea59;p=bacula%2Fbacula baculum: Hide users input on ESC key press --- diff --git a/gui/baculum/protected/JavaScript/misc.js b/gui/baculum/protected/JavaScript/misc.js index b5d3706b1b..6bd86a28da 100644 --- a/gui/baculum/protected/JavaScript/misc.js +++ b/gui/baculum/protected/JavaScript/misc.js @@ -247,17 +247,21 @@ var Users = { $(this.ids.create_user.add_user).show(); $(this.ids.create_user.newuser).focus(); }.bind(this)); - document.getElementById(this.ids.create_user.newuser).addEventListener('keypress', function(e) { + document.getElementById(this.ids.create_user.newuser).addEventListener('keydown', function(e) { var target = e.target || e.srcElement; if (e.keyCode == 13) { - target.parentNode.getElementsByTagName('A')[0].click(); + $(target.nextElementSibling).click(); + } else if (e.keyCode == 27) { + this.cancelAddUser(); } return false; }.bind(this)); - document.getElementById(this.ids.create_user.newpwd).addEventListener('keypress', function(e) { + document.getElementById(this.ids.create_user.newpwd).addEventListener('keydown', function(e) { var target = e.target || e.srcElement; if (e.keyCode == 13) { $(target.nextElementSibling).click(); + } else if (e.keyCode == 27) { + this.cancelAddUser(); } return false; }.bind(this)); @@ -301,7 +305,7 @@ var Users = { }, changePwd: function(el, user) { var valid = true; - var pwd = el.previousElementSibling.value; + var pwd = el.value; if (this.pwdValidator(pwd) === false) { alert(this.txt.invalid_pwd); @@ -313,7 +317,7 @@ var Users = { this.action_callback('chpwd', user, pwd); } }, - cancelAddUser: function(el) { + cancelAddUser: function() { $(this.ids.create_user.add_user).hide(); }, cancelChangePwd: function(el) { diff --git a/gui/baculum/protected/Pages/Home.page b/gui/baculum/protected/Pages/Home.page index 7fa7da3e26..0dd34c3df9 100644 --- a/gui/baculum/protected/Pages/Home.page +++ b/gui/baculum/protected/Pages/Home.page @@ -319,8 +319,8 @@ <%[ Change password ]%> - - + + <%[ Save ]%>