X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FControls.js;h=0827ff76973d3ce2d892b810e8c3c5066000fe5b;hb=7fa78f65569adab3acf4c6ea2764e3d57f069835;hp=f386627fbca091fb0c923a017dd62e16ebd819c3;hpb=868758a60c47c984eb76bae45183d063981ebdd5;p=blerg.git diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js index f386627..0827ff7 100644 --- a/www/jssrc/blerg/Controls.js +++ b/www/jssrc/blerg/Controls.js @@ -15,7 +15,7 @@ enyo.kind({ }, components: [ {name: "loggedOutControls", components: [ - {tag: "form", onsubmit: "loginClicked", classes: "login", components: [ + {tag: "form", onkeyup: "loginKeyUp", classes: "login", components: [ {kind: "onyx.Groupbox", components: [ {kind: "onyx.InputDecorator", components: [ {name: "username", kind: "onyx.Input", placeholder: "Username", attributes: {tabindex: 1}} @@ -72,12 +72,24 @@ enyo.kind({ inEvent.preventDefault(); return true; }, + loginKeyUp: function(inSender, inEvent) { + if (inEvent.keyCode == 13) { + if (this.$.username.hasFocus()) { + this.$.password.focus(); + } else { + this.loginClicked(this, inEvent); + } + return true; + } + }, logoutClicked: function() { this.bubble('onTryLogout'); return true; }, login: function(inSender, inEvent) { this.$.password.setValue(''); + // TODO: Replace with regular blur() call in future enyo + this.$.password.node.blur(); this.setLoggedIn(true); this.$.userlink.setAttribute('href', '/#' + inEvent.username); this.$.userlink.setContent('@' + inEvent.username);