Introduce locale select component and make replacement on profile page

This commit is contained in:
Marcus Moore
2025-05-08 15:02:35 -07:00
committed by snipe
parent b1a6e3f8a2
commit 75924be958
2 changed files with 25 additions and 1 deletions

View File

@@ -49,7 +49,7 @@
<div class="col-md-7">
@if (!config('app.lock_passwords'))
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}
<x-input.locale-select name="locales" :selected="old('locale', $user->locale)"/>
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
@else
<p class="help-block">{{ trans('general.feature_disabled') }}</p>

View File

@@ -0,0 +1,24 @@
@props([
'name' => 'locale',
'selected' => null,
])
<div>
<select
name="{{ $name }}"
{{ $attributes->merge(['class' => 'select2', 'style' => 'width:100%']) }}
aria-label="{{ $name }}"
data-placeholder="{{ trans('localizations.select_language') }}"
>
<option value="" role="option">{{ trans('localizations.select_language') }}</option>'
@foreach (trans('localizations.languages') as $abbr => $locale)
<option
value="{{ $abbr }}"
role="option"
@selected($abbr == $selected)
aria-selected="{{ $abbr == $selected ? 'true' : 'false' }}"
>
{{ $locale }}
</option>
@endforeach
</select>
</div>