feat: Select lingua

This commit is contained in:
Maicol Battistini 2021-11-10 18:41:25 +01:00
parent 59c50c80b4
commit 4b6a3d599b
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
3 changed files with 11 additions and 4 deletions

View File

@ -98,7 +98,7 @@
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="20">
<list size="21">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
@ -119,6 +119,7 @@
<item index="17" class="java.lang.String" itemvalue="mwc-dialog" />
<item index="18" class="java.lang.String" itemvalue="text-field" />
<item index="19" class="java.lang.String" itemvalue="text-area" />
<item index="20" class="java.lang.String" itemvalue="mwc-select" />
</list>
</value>
</option>

View File

@ -145,7 +145,7 @@ export default class SetupPage extends Page {
</Cell>
<Cell>
<h4>{__('Lingua')}</h4>
<mwc-select>
<mwc-select id="language-select">
{this.languages()}
</mwc-select>
<hr />
@ -195,6 +195,8 @@ export default class SetupPage extends Page {
.toggleClass('mdc-high-contrast');
});
$('mwc-select#language-select').on('action', this.onLanguageSelected);
// Fix for mwc button inside <a> tags
$('a')
.has('mwc-button')
@ -216,6 +218,10 @@ export default class SetupPage extends Page {
this.saveDatabase(formData);
}
onLanguageSelected(event: Event) {
window.location.href = window.route('app.language', {language: event.target.value});
}
async testDatabase(silent = false): boolean {
const form = $('form');
let response;

View File

@ -26,10 +26,10 @@ Route::inertia('setup', 'SetupPage', [
)),
'license' => cache()->rememberForever('app.license', fn () => file_get_contents(base_path('LICENSE'))),
]);
Route::options('setup/test', [SetupController::class, 'testDatabase'])->name('setup.test')->withoutMiddleware('csrf')->middleware(\Illuminatech\MultipartMiddleware\MultipartFormDataParser::class);
Route::options('setup/test', [SetupController::class, 'testDatabase'])->name('setup.test')->withoutMiddleware('csrf');
Route::get('lang/{language}', function ($language) {
app()->setLocale($language);
return redirect()->back();
})->name('language');
})->name('app.language');