Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/resources/chromeos/login/gaia_input_form.js

Issue 1110493002: ChromeOS Gaia: UI polishing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed line-height for gaia-body-text Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 Polymer('gaia-input-form', { 6 Polymer('gaia-input-form', (function() {
7 inputValue: '', 7 var INPUT_EMAIL_PATTERN = "^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+(@[^\\s@]+)?$";
8 8
9 onButtonClicked: function() { 9 return {
10 this.fire('buttonClick');
11 },
12 10
13 onKeyDown: function(e) { 11 inputValue: '',
14 this.setValid(true);
15 if (e.keyCode == 13 && !this.$.button.disabled)
16 this.$.button.fire('tap');
17 },
18 12
19 onTap: function() { 13 onButtonClicked: function() {
20 this.setValid(true); 14 this.fire('buttonClick');
21 }, 15 },
22 16
23 focus: function() { 17 onKeyDown: function(e) {
24 this.$.inputForm.focus(); 18 this.setValid(true);
25 }, 19 this.setDomainVisibility();
20 if (e.keyCode == 13 && !this.$.button.disabled)
21 this.$.button.fire('tap');
22 },
26 23
27 checkValidity: function() { 24 onKeyUp: function(e) {
28 var input = this.$.inputForm; 25 this.setDomainVisibility();
29 var isValid = input.validity.valid; 26 },
30 this.setValid(isValid);
31 return isValid;
32 },
33 27
34 setValid: function(isValid) { 28 setDomainVisibility: function() {
35 this.$.paperInputDecorator.isInvalid = !isValid; 29 this.$.emailDomain.hidden = !(this.inputValue.indexOf('@') === -1);
36 } 30 },
37 }); 31
32 ready: function() {
33 if (this.inputType == 'email') {
34 this.$.inputForm.type = 'text';
35 this.$.inputForm.pattern = INPUT_EMAIL_PATTERN;
36 this.$.inputForm.addEventListener('keyup', this.onKeyUp.bind(this));
37 } else {
38 this.$.inputForm.type = this.inputType;
39 }
40 },
41
42 onTap: function() {
43 this.setValid(true);
44 },
45
46 focus: function() {
47 this.$.inputForm.focus();
48 },
49
50 checkValidity: function() {
51 var input = this.$.inputForm;
52 var isValid = input.validity.valid;
53 this.setValid(isValid);
54 return isValid;
55 },
56
57 setValid: function(isValid) {
58 this.$.paperInputDecorator.isInvalid = !isValid;
59 }
60 };
61 })());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698