Use Button component to submit all forms

This commit is contained in:
Bubka 2020-01-21 17:03:00 +01:00
parent fa3537d957
commit fe916c08c0
7 changed files with 25 additions and 30 deletions

View File

@ -1,12 +1,12 @@
<template>
<button
:type="nativeType"
:type="nativeType"
:disabled="isLoading"
:class="{
'button': true,
[`${color}`]: true,
'is-large': isLarge,
'is-focused': isFocused,
}"
class="button">
'is-loading': isLoading,
}">
<slot />
</button>
</template>
@ -26,15 +26,10 @@
default: 'submit'
},
isFocused: {
isLoading: {
type: Boolean,
default: false
},
isLarge: {
type: Boolean,
default: false
}
}
}

View File

@ -3,24 +3,24 @@
<div class="columns is-mobile is-centered">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
<h1 class="title">{{ $t('auth.forms.login') }}</h1>
<form method="POST" action="/login">
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
<div class="field">
<label class="label">{{ $t('auth.forms.email') }}</label>
<div class="control">
<input id="email" type="email" class="input" v-model="form.email" required autofocus />
<input id="email" type="email" class="input" v-model="form.email" autofocus />
</div>
<field-error :form="form" field="email" />
</div>
<div class="field">
<label class="label">{{ $t('auth.forms.password') }}</label>
<div class="control">
<input id="password" type="password" class="input" v-model="form.password" required />
<input id="password" type="password" class="input" v-model="form.password" />
</div>
<field-error :form="form" field="password" />
</div>
<div class="field">
<div class="control">
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.sign_in') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('auth.sign_in') }}</v-button>
</div>
</div>
<div class="field" v-if="errorMessage">

View File

@ -3,38 +3,38 @@
<div class="columns is-mobile is-centered">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
<h1 class="title">{{ $t('auth.register') }}</h1>
<form method="POST" action="/register">
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
<div class="field">
<label class="label">{{ $t('auth.forms.name') }}</label>
<div class="control">
<input id="name" type="text" class="input" v-model="form.name" required autofocus />
<input id="name" type="text" class="input" v-model="form.name" autofocus />
</div>
<field-error :form="form" field="name" />
</div>
<div class="field">
<label class="label">{{ $t('auth.forms.email') }}</label>
<div class="control">
<input id="email" type="email" class="input" v-model="form.email" required />
<input id="email" type="email" class="input" v-model="form.email" />
</div>
<field-error :form="form" field="email" />
</div>
<div class="field">
<label class="label">{{ $t('auth.forms.password') }}</label>
<div class="control">
<input id="password" type="password" class="input" v-model="form.password" required />
<input id="password" type="password" class="input" v-model="form.password" />
</div>
<field-error :form="form" field="password" />
</div>
<div class="field">
<label class="label">{{ $t('auth.forms.confirm_password') }}</label>
<div class="control">
<input id="password_confirmation" type="password" class="input" v-model="form.password_confirmation" required />
<input id="password_confirmation" type="password" class="input" v-model="form.password_confirmation" />
</div>
<field-error :form="form" field="password_confirmation" />
</div>
<div class="field">
<div class="control">
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.register') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('auth.register') }}</v-button>
</div>
</div>
</form>

View File

@ -3,17 +3,17 @@
<div class="columns is-mobile is-centered">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
<h1 class="title">{{ $t('auth.forms.reset_password') }}</h1>
<form method="POST" action="/password/email">
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
<div class="field">
<label class="label">{{ $t('auth.forms.email') }}</label>
<div class="control">
<input id="email" type="email" class="input" v-model="form.email" required autofocus />
<input id="email" type="email" class="input" v-model="form.email" autofocus />
</div>
<field-error :form="form" field="email" />
</div>
<div class="field is-grouped">
<div class="control">
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.forms.send_password_reset_link') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('auth.forms.send_password_reset_link') }}</v-button>
</div>
<div class="control">
<router-link :to="{ name: 'login' }" class="button is-text">{{ $t('commons.cancel') }}</router-link>

View File

@ -3,7 +3,7 @@
<div class="columns is-mobile is-centered">
<div class="column is-two-thirds-tablet is-half-desktop is-one-third-widescreen is-one-quarter-fullhd">
<h1 class="title">{{ $t('auth.forms.new_password') }}</h1>
<form method="POST">
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
<div class="field">
<label class="label">{{ $t('auth.forms.email') }}</label>
<div class="control">
@ -14,20 +14,20 @@
<div class="field">
<label class="label">{{ $t('auth.forms.new_password') }}</label>
<div class="control">
<input id="password" type="password" class="input" v-model="form.password" required />
<input id="password" type="password" class="input" v-model="form.password" />
</div>
<field-error :form="form" field="password" />
</div>
<div class="field">
<label class="label">{{ $t('auth.forms.confirm_password') }}</label>
<div class="control">
<input id="password_confirmation" type="password" class="input" v-model="form.password_confirmation" required />
<input id="password_confirmation" type="password" class="input" v-model="form.password_confirmation" />
</div>
<field-error :form="form" field="password_confirmation" />
</div>
<div class="field is-grouped">
<div class="control">
<button type="submit" class="button is-link" @click="handleSubmit">{{ $t('auth.forms.change_password') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('auth.forms.change_password') }}</v-button>
</div>
<div class="control">
<router-link :to="{ name: 'login' }" class="button is-text">{{ $t('commons.cancel') }}</router-link>

View File

@ -76,7 +76,7 @@
<field-error :form="form" field="icon" class="help-for-file" />
<div class="field is-grouped">
<div class="control">
<button type="submit" class="button is-link" :disabled="form.busy" >{{ $t('twofaccounts.forms.create') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('twofaccounts.forms.create') }}</v-button>
</div>
<div class="control">
<button class="button is-text" @click="cancelCreation">{{ $t('commons.cancel') }}</button>

View File

@ -39,7 +39,7 @@
<field-error :form="form" field="icon" class="help-for-file" />
<div class="field is-grouped">
<div class="control">
<button type="submit" class="button is-link">{{ $t('twofaccounts.forms.save') }}</button>
<v-button :isLoading="form.isBusy" >{{ $t('twofaccounts.forms.save') }}</v-button>
</div>
<div class="control">
<button class="button is-text" @click.prevent="cancelCreation">{{ $t('commons.cancel') }}</button>