Merge pull request #476 from h3poteto/iss-453

closes #453 Check and submit instance with enter key in login form
This commit is contained in:
AkiraFukushima 2018-08-08 22:37:20 +09:00 committed by GitHub
commit 4aa9c65467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 13 deletions

View File

@ -36,7 +36,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#login /deep/ { #login {
background-color: #292f3f; background-color: #292f3f;
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
@ -49,15 +49,5 @@ export default {
font-size: 24px; font-size: 24px;
} }
} }
.el-form-item__label {
color: #f0f3f9;
}
.el-input__inner {
background-color: #373d48;
color: #ffffff;
border: 0;
}
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<el-form ref="loginForm" label-width="120px" label-position="top" v-on:submit.prevent="confirm('loginForm')" class="login-form" :rules="rules" :model="form"> <el-form ref="loginForm" label-width="120px" label-position="top" v-on:submit.prevent="confirm('loginForm')" class="login-form" :rules="rules" :model="form">
<el-form-item label="First, let's log in to a Mastodon instance. Please enter an instance domain name." prop="domainName"> <el-form-item label="First, let's log in to a Mastodon instance. Please enter an instance domain name." prop="domainName">
<el-input v-model="form.domainName" placeholder="mastodon.social"></el-input> <el-input v-model="form.domainName" placeholder="mastodon.social" v-shortkey="['enter']" @shortkey.native="handleKey"></el-input>
</el-form-item> </el-form-item>
<!-- Dummy form to guard submitting with enter --> <!-- Dummy form to guard submitting with enter -->
<el-form-item class="hidden"> <el-form-item class="hidden">
@ -106,16 +106,33 @@ export default {
return false return false
} }
}) })
},
handleKey (event) {
if (!this.selectedInstance) {
this.confirm('loginForm')
} else {
this.login()
}
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login-form { .login-form /deep/ {
margin: 0 auto; margin: 0 auto;
width: 300px; width: 300px;
.el-form-item__label {
color: #f0f3f9;
}
.el-input__inner {
background-color: #373d48;
color: #fff;
border: 0;
}
.instance-group { .instance-group {
text-align: left; text-align: left;
margin: 0 auto; margin: 0 auto;