mirror of
https://github.com/grocy/grocy.git
synced 2026-04-06 21:06:15 +02:00
Use a standard user-settings-control and start a new generic user settings page, not a separate page for the locale setting
This commit is contained in:
parent
4bc84875a9
commit
d29b1b8ae2
|
|
@ -45,9 +45,9 @@ class UsersController extends BaseController
|
|||
]);
|
||||
}
|
||||
|
||||
public function LocaleForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
public function UserSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->renderPage($response, 'locale', [
|
||||
return $this->renderPage($response, 'usersettings', [
|
||||
'languages' => array_filter(scandir(__DIR__.'/../localization'), function ($item){
|
||||
if($item == "." || $item == "..")
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1894,3 +1894,9 @@ msgstr ""
|
|||
|
||||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
msgid "User settings"
|
||||
msgstr ""
|
||||
|
||||
msgid "Default"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class LocaleMiddleware extends BaseMiddleware
|
|||
if(GROCY_AUTHENTICATED)
|
||||
{
|
||||
$locale = UsersService::getInstance()->GetUserSetting(GROCY_USER_ID, 'locale');
|
||||
if (isset($locale)) {
|
||||
if (isset($locale) && !empty($locale)) {
|
||||
if (in_array($locale, scandir(__DIR__ . '/../localization'))) {
|
||||
return $locale;
|
||||
}
|
||||
|
|
|
|||
1
public/viewjs/usersettings.js
Normal file
1
public/viewjs/usersettings.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
$("#locale").val(Grocy.UserSettings.locale);
|
||||
|
|
@ -32,7 +32,7 @@ $app->group('', function(RouteCollectorProxy $group)
|
|||
$group->get('/users', '\Grocy\Controllers\UsersController:UsersList');
|
||||
$group->get('/user/{userId}', '\Grocy\Controllers\UsersController:UserEditForm');
|
||||
$group->get('/user/{userId}/permissions', '\Grocy\Controllers\UsersController:PermissionList');
|
||||
$group->get('/usersettings/locale', '\Grocy\Controllers\UsersController:LocaleForm');
|
||||
$group->get('/usersettings', '\Grocy\Controllers\UsersController:UserSettings');
|
||||
|
||||
// Stock routes
|
||||
if (GROCY_FEATURE_FLAG_STOCK)
|
||||
|
|
|
|||
|
|
@ -416,8 +416,8 @@
|
|||
@if(GROCY_FEATURE_FLAG_TASKS)
|
||||
<a class="dropdown-item discrete-link permission-TASKS" href="{{ $U('/taskssettings') }}"><i class="fas fa-tasks"></i> {{ $__t('Tasks settings') }}</a>
|
||||
@endif
|
||||
<a data-href="{{ $U('/usersettings/locale') }}" class="dropdown-item discrete-link link-return">
|
||||
<i class="fas fa-globe"></i> {{ $__t('Language') }}
|
||||
<a data-href="{{ $U('/usersettings') }}" class="dropdown-item discrete-link link-return">
|
||||
<i class="fas fa-globe"></i> {{ $__t('User settings') }}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
@if(GROCY_SHOW_AUTH_VIEWS)
|
||||
|
|
|
|||
30
views/usersettings.blade.php
Normal file
30
views/usersettings.blade.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
@extends('layout.default')
|
||||
|
||||
@section('title', $__t('User settings'))
|
||||
@section('activeNav', '')
|
||||
@section('viewJsName', 'usersettings')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h2 class="title">@yield('title')</h2>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="locale">{{ $__t('Language') }}</label>
|
||||
<select class="form-control user-setting-control" id="locale" data-setting-key="locale">
|
||||
<option value="">{{ $__t('Default') }}</option>
|
||||
@foreach($languages as $lang)
|
||||
<option value="{{ $lang }}" @if(GROCY_LOCALE == $lang) checked @endif>{{ $__t($lang) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<a href="{{ $U('/') }}" class="btn btn-success">{{ $__t('OK') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
Loading…
Reference in New Issue
Block a user