Choose device name screen: Finish by pressing enter (#2085)

This commit is contained in:
Scott Nonnenberg 2018-03-02 15:34:51 -08:00 committed by GitHub
parent 40ee88ead3
commit 59bee6690d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 15 deletions

View file

@ -759,6 +759,7 @@
</div> </div>
{{/isStep3}} {{/isStep3}}
{{#isStep4}} {{#isStep4}}
<form id='link-phone'>
<div id='step4' class='step'> <div id='step4' class='step'>
<div class='inner'> <div class='inner'>
<div class='step-body'> <div class='step-body'>
@ -768,6 +769,7 @@
<input type='text' class='device-name' spellcheck='false' maxlength='50' /> <input type='text' class='device-name' spellcheck='false' maxlength='50' />
</div> </div>
</div> </div>
<div class='nav'> <div class='nav'>
<div> <div>
<a class='button finish'>{{ finishLinkingPhoneButton }}</a> <a class='button finish'>{{ finishLinkingPhoneButton }}</a>
@ -775,6 +777,7 @@
</div> </div>
</div> </div>
</div> </div>
</form>
{{/isStep4}} {{/isStep4}}
{{#isStep5}} {{#isStep5}}
<div id='step5' class='step'> <div id='step5' class='step'>

View file

@ -23,7 +23,8 @@
className: 'main full-screen-flow', className: 'main full-screen-flow',
events: { events: {
'click .try-again': 'connect', 'click .try-again': 'connect',
// handler for finish button is in confirmNumber() 'click .finish': 'finishLinking',
// the actual next step happens in confirmNumber() on submit form #link-phone
}, },
initialize: function(options) { initialize: function(options) {
options = options || {}; options = options || {};
@ -143,13 +144,17 @@
this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.config.hostname); this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.config.hostname);
this.$(DEVICE_NAME_SELECTOR).focus(); this.$(DEVICE_NAME_SELECTOR).focus();
}, },
finishLinking: function() {
// We use a form so we get submit-on-enter behavior
this.$('#link-phone').submit();
},
confirmNumber: function(number) { confirmNumber: function(number) {
window.removeSetupMenuItems(); window.removeSetupMenuItems();
this.selectStep(Steps.ENTER_NAME); this.selectStep(Steps.ENTER_NAME);
this.setDeviceNameDefault(); this.setDeviceNameDefault();
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
this.$('.finish').click(function(e) { this.$('#link-phone').submit(function(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();

View file

@ -735,6 +735,10 @@ input[type=text], input[type=search], textarea {
margin-right: auto; margin-right: auto;
} }
form {
height: 100%;
width: 100%;
}
.step { .step {
height: 100%; height: 100%;
width: 100%; width: 100%;