mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-01 12:43:46 +01:00
Add Language setting to Profile front-end
This commit is contained in:
parent
48edaa6907
commit
83aa5667e2
54
resources/js/components/FormSelect.vue
Normal file
54
resources/js/components/FormSelect.vue
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<template>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" v-html="label"></label>
|
||||||
|
<div class="control">
|
||||||
|
<div class="select">
|
||||||
|
<select v-model="form[fieldName]">
|
||||||
|
<option v-for="option in options" :value="option.value">{{ option.text }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<field-error :form="form" :field="fieldName" />
|
||||||
|
<p class="help" v-html="help" v-if="help"></p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'FormSelect',
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
fieldName: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
form: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
|
help: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
2
resources/js/components/index.js
vendored
2
resources/js/components/index.js
vendored
@ -3,6 +3,7 @@ import Button from './Button'
|
|||||||
import FieldError from './FieldError'
|
import FieldError from './FieldError'
|
||||||
import FormWrapper from './FormWrapper'
|
import FormWrapper from './FormWrapper'
|
||||||
import FormField from './FormField'
|
import FormField from './FormField'
|
||||||
|
import FormSelect from './FormSelect'
|
||||||
import FormButtons from './FormButtons'
|
import FormButtons from './FormButtons'
|
||||||
import VueFooter from './Footer'
|
import VueFooter from './Footer'
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ import VueFooter from './Footer'
|
|||||||
FieldError,
|
FieldError,
|
||||||
FormWrapper,
|
FormWrapper,
|
||||||
FormField,
|
FormField,
|
||||||
|
FormSelect,
|
||||||
FormButtons,
|
FormButtons,
|
||||||
VueFooter,
|
VueFooter,
|
||||||
].forEach(Component => {
|
].forEach(Component => {
|
||||||
|
2
resources/js/langs/locales.js
vendored
2
resources/js/langs/locales.js
vendored
@ -69,6 +69,7 @@ export default {
|
|||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"account": "Account",
|
"account": "Account",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
|
"language": "Language",
|
||||||
"confirm": [],
|
"confirm": [],
|
||||||
"forms": {
|
"forms": {
|
||||||
"edit_settings": "Edit settings"
|
"edit_settings": "Edit settings"
|
||||||
@ -311,6 +312,7 @@ export default {
|
|||||||
"settings": "Réglages",
|
"settings": "Réglages",
|
||||||
"account": "Compte",
|
"account": "Compte",
|
||||||
"password": "Mot de passe",
|
"password": "Mot de passe",
|
||||||
|
"language": "Langue",
|
||||||
"confirm": [],
|
"confirm": [],
|
||||||
"forms": {
|
"forms": {
|
||||||
"edit_settings": "Modifier les réglages"
|
"edit_settings": "Modifier les réglages"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<form-wrapper :fail="fail" :success="success">
|
<form-wrapper :fail="fail" :success="success">
|
||||||
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
<form @submit.prevent="handleSubmit" @keydown="form.onKeydown($event)">
|
||||||
<form-field :form="form" fieldName="FirstSetting" :label="$t('auth.forms.FirstSetting')" />
|
<form-select :options="options" :form="form" fieldName="lang" :label="$t('settings.language')" />
|
||||||
<form-buttons :isBusy="form.isBusy" :caption="$t('commons.save')" />
|
<form-buttons :isBusy="form.isBusy" :caption="$t('commons.save')" />
|
||||||
</form>
|
</form>
|
||||||
</form-wrapper>
|
</form-wrapper>
|
||||||
@ -17,8 +17,12 @@
|
|||||||
success: '',
|
success: '',
|
||||||
fail: '',
|
fail: '',
|
||||||
form: new Form({
|
form: new Form({
|
||||||
FirstSetting: ''
|
lang: 'fr'
|
||||||
})
|
}),
|
||||||
|
options: [
|
||||||
|
{ text: 'en', value: 'en' },
|
||||||
|
{ text: 'fr', value: 'fr' },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
'settings' => 'Settings',
|
'settings' => 'Settings',
|
||||||
'account' => 'Account',
|
'account' => 'Account',
|
||||||
'password' => 'Password',
|
'password' => 'Password',
|
||||||
|
'language' => 'Language',
|
||||||
'confirm' => [
|
'confirm' => [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
'settings' => 'Réglages',
|
'settings' => 'Réglages',
|
||||||
'account' => 'Compte',
|
'account' => 'Compte',
|
||||||
'password' => 'Mot de passe',
|
'password' => 'Mot de passe',
|
||||||
|
'language' => 'Langue',
|
||||||
'confirm' => [
|
'confirm' => [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="has-background-black-ter" lang="en">
|
<html class="has-background-black-ter" lang="{{ option('lang', 'en') }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
Loading…
Reference in New Issue
Block a user