allow to switch language on any page (#299)
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
"friendsofsymfony/rest-bundle": "^2.3",
|
"friendsofsymfony/rest-bundle": "^2.3",
|
||||||
"friendsofsymfony/user-bundle": "~2.0",
|
"friendsofsymfony/user-bundle": "~2.0",
|
||||||
"jms/serializer-bundle": "^2.4",
|
"jms/serializer-bundle": "^2.4",
|
||||||
"kevinpapst/adminlte-bundle": "^2.0",
|
"kevinpapst/adminlte-bundle": "^2.1",
|
||||||
"nelmio/api-doc-bundle": "^3.2",
|
"nelmio/api-doc-bundle": "^3.2",
|
||||||
"ocramius/proxy-manager": "2.1.1",
|
"ocramius/proxy-manager": "2.1.1",
|
||||||
"sensio/framework-extra-bundle": "^5.2",
|
"sensio/framework-extra-bundle": "^5.2",
|
||||||
|
|||||||
17
composer.lock
generated
17
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "0cf38f9b4970d089487593f344ed0282",
|
"content-hash": "26a66efe4ec32d6644deeaff090a303b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "beberlei/DoctrineExtensions",
|
"name": "beberlei/DoctrineExtensions",
|
||||||
@@ -1840,16 +1840,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "kevinpapst/adminlte-bundle",
|
"name": "kevinpapst/adminlte-bundle",
|
||||||
"version": "2.0",
|
"version": "2.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/kevinpapst/AdminLTEBundle.git",
|
"url": "https://github.com/kevinpapst/AdminLTEBundle.git",
|
||||||
"reference": "ee9406d2fc60a4d26d317fe555104df803ca130c"
|
"reference": "43840776d45cb86a4dbcb915efa582eb41c5a564"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/kevinpapst/AdminLTEBundle/zipball/ee9406d2fc60a4d26d317fe555104df803ca130c",
|
"url": "https://api.github.com/repos/kevinpapst/AdminLTEBundle/zipball/43840776d45cb86a4dbcb915efa582eb41c5a564",
|
||||||
"reference": "ee9406d2fc60a4d26d317fe555104df803ca130c",
|
"reference": "43840776d45cb86a4dbcb915efa582eb41c5a564",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1865,7 +1865,8 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^2.10",
|
"friendsofphp/php-cs-fixer": "^2.10",
|
||||||
"phpspec/prophecy": "^1.6"
|
"phpspec/prophecy": "^1.6",
|
||||||
|
"phpunit/phpunit": "^7.3"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"friendsofsymfony/user-bundle": "Allows easy user management and security support",
|
"friendsofsymfony/user-bundle": "Allows easy user management and security support",
|
||||||
@@ -1895,8 +1896,8 @@
|
|||||||
"homepage": "https://www.kevinpapst.de"
|
"homepage": "https://www.kevinpapst.de"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Admin Theme based on the AdminLTE 2.3 for easy integration with Symfony 4",
|
"description": "Admin Theme based on the AdminLTE 2.4.8 for easy integration with Symfony 4",
|
||||||
"time": "2018-08-15T21:18:05+00:00"
|
"time": "2018-09-02T17:21:38+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Form\UserPreferencesForm;
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sidebar controller
|
* Sidebar controller
|
||||||
@@ -20,34 +20,14 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
|||||||
class SidebarController extends AbstractController
|
class SidebarController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* @param Request $originalRequest
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function homeAction()
|
public function settingsAction(Request $originalRequest)
|
||||||
{
|
{
|
||||||
return $this->render('sidebar/home.html.twig', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function settingsAction()
|
|
||||||
{
|
|
||||||
$user = $this->getUser();
|
|
||||||
|
|
||||||
return $this->render('sidebar/settings.html.twig', [
|
return $this->render('sidebar/settings.html.twig', [
|
||||||
'user' => $user,
|
'user' => $this->getUser(),
|
||||||
|
'originalRequest' => $originalRequest,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
$form = $this->createForm(UserPreferencesForm::class, $user, [
|
|
||||||
'action' => $this->generateUrl('user_profile_preferences', ['username' => $user->getUsername()]),
|
|
||||||
'method' => 'POST',
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $this->render('sidebar/settings.html.twig', [
|
|
||||||
'form' => $form->createView(),
|
|
||||||
]);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,8 @@
|
|||||||
{{ 'preferences.label.language'|trans({}, 'sidebar') }}
|
{{ 'preferences.label.language'|trans({}, 'sidebar') }}
|
||||||
<select class="pull-right" onchange="window.location.href = this.options[this.selectedIndex].value;">
|
<select class="pull-right" onchange="window.location.href = this.options[this.selectedIndex].value;">
|
||||||
{% for locale in locales() %}
|
{% for locale in locales() %}
|
||||||
<option value="{{ path(app.request.get('_route', 'homepage'), app.request.get('_route_params', [])|merge({ _locale: locale.code })) }}" {% if app.request.locale == locale.code %}selected="selected"{% endif %}>{{ locale.name|capitalize }}</option>
|
<option value="{{ path(originalRequest.get('_route', 'homepage'), originalRequest.get('_route_params', [])|merge({ _locale: locale.code })) }}" {% if app.request.locale == locale.code %}selected="selected"{% endif %}>{{ locale.name|capitalize }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{#
|
|
||||||
{{ form_start(form) }}
|
|
||||||
{{ form_widget(form) }}
|
|
||||||
<input type="submit" value="{{ 'action.save'|trans }}" class="btn btn-primary" />
|
|
||||||
{{ form_end(form) }}
|
|
||||||
#}
|
|
||||||
Reference in New Issue
Block a user