diff --git a/README.md b/README.md index 392b9936..839c3f86 100644 --- a/README.md +++ b/README.md @@ -90,12 +90,13 @@ APP_ENV=dev APP_SECRET=some_random_secret_string_for_your_installation ``` -Now create the database schemas: +Now create the database schemas and warm up the cache: ```bash $ bin/console doctrine:schema:create +$ bin/console cache:warmup --env=prod ``` -And finally create your first user: +Finally create your first user: ```bash $ bin/console kimai:create-user username password admin@example.com ROLE_SUPER_ADMIN diff --git a/composer.lock b/composer.lock index b23ad57f..5af931d8 100644 --- a/composer.lock +++ b/composer.lock @@ -2508,24 +2508,24 @@ }, { "name": "symfony/flex", - "version": "v1.0.61", + "version": "v1.0.66", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "f872f8faccf5ff95678e1e428f460a333ba1e5d0" + "reference": "b366e902710c8dc8d8be97ed8d64ef574d9bffcb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/f872f8faccf5ff95678e1e428f460a333ba1e5d0", - "reference": "f872f8faccf5ff95678e1e428f460a333ba1e5d0", + "url": "https://api.github.com/repos/symfony/flex/zipball/b366e902710c8dc8d8be97ed8d64ef574d9bffcb", + "reference": "b366e902710c8dc8d8be97ed8d64ef574d9bffcb", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1", + "composer-plugin-api": "^1.0", "php": "^7.0" }, "require-dev": { - "composer/composer": "^1.4", + "composer/composer": "^1.0.2", "symfony/phpunit-bridge": "^3.2.8" }, "type": "composer-plugin", @@ -2550,7 +2550,7 @@ "email": "fabien.potencier@gmail.com" } ], - "time": "2018-01-12T13:09:44+00:00" + "time": "2018-01-21T09:15:48+00:00" }, { "name": "symfony/form", @@ -3984,21 +3984,21 @@ }, { "name": "symfony/thanks", - "version": "v1.0.1", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/symfony/thanks.git", - "reference": "b637913a92664571afd1067fc645ecb30c9cf5b2" + "reference": "8c12bbe4baabcb8e640efaaaab40e3a4497c9fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/thanks/zipball/b637913a92664571afd1067fc645ecb30c9cf5b2", - "reference": "b637913a92664571afd1067fc645ecb30c9cf5b2", + "url": "https://api.github.com/repos/symfony/thanks/zipball/8c12bbe4baabcb8e640efaaaab40e3a4497c9fb4", + "reference": "8c12bbe4baabcb8e640efaaaab40e3a4497c9fb4", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1", - "php": "^5.5.9|^7.0.8" + "composer-plugin-api": "^1.0", + "php": "^5.5.9|^7.0.0" }, "type": "composer-plugin", "extra": { @@ -4023,7 +4023,7 @@ } ], "description": "Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)!", - "time": "2018-01-03T09:30:52+00:00" + "time": "2018-01-19T16:12:41+00:00" }, { "name": "symfony/translation", diff --git a/config/routes/dev/twig.yaml b/config/routes/dev/twig.yaml index 56fecc76..a85c61e5 100644 --- a/config/routes/dev/twig.yaml +++ b/config/routes/dev/twig.yaml @@ -1,6 +1,6 @@ _errors: resource: '@TwigBundle/Resources/config/routing/errors.xml' - prefix: /_error + prefix: /{_locale}/_error requirements: _locale: '%app_locales%' defaults: diff --git a/src/Controller/Admin/CustomerController.php b/src/Controller/Admin/CustomerController.php index 6e1fdb19..4785d021 100644 --- a/src/Controller/Admin/CustomerController.php +++ b/src/Controller/Admin/CustomerController.php @@ -161,7 +161,7 @@ class CustomerController extends AbstractController protected function getToolbarForm(CustomerQuery $query) { return $this->createForm(CustomerToolbarForm::class, $query, [ - 'action' => $this->generateUrl('admin_customer_paginated', [ + 'action' => $this->generateUrl('admin_customer', [ 'page' => $query->getPage(), ]), 'method' => 'GET', diff --git a/src/Controller/Admin/ProjectController.php b/src/Controller/Admin/ProjectController.php index 295806e4..69dd4777 100644 --- a/src/Controller/Admin/ProjectController.php +++ b/src/Controller/Admin/ProjectController.php @@ -165,7 +165,7 @@ class ProjectController extends AbstractController protected function getToolbarForm(ProjectQuery $query) { return $this->createForm(ProjectToolbarForm::class, $query, [ - 'action' => $this->generateUrl('admin_project_paginated', [ + 'action' => $this->generateUrl('admin_project', [ 'page' => $query->getPage(), ]), 'method' => 'GET', diff --git a/src/Controller/Admin/UserController.php b/src/Controller/Admin/UserController.php index 59346857..04290eda 100644 --- a/src/Controller/Admin/UserController.php +++ b/src/Controller/Admin/UserController.php @@ -104,7 +104,7 @@ class UserController extends AbstractController protected function getToolbarForm(UserQuery $query) { return $this->createForm(UserToolbarForm::class, $query, [ - 'action' => $this->generateUrl('admin_user_paginated', [ + 'action' => $this->generateUrl('admin_user', [ 'page' => $query->getPage(), ]), 'method' => 'GET', diff --git a/src/EventSubscriber/NavbarShowUserSubscriber.php b/src/EventSubscriber/NavbarShowUserSubscriber.php index 29d7ab1f..a7078792 100644 --- a/src/EventSubscriber/NavbarShowUserSubscriber.php +++ b/src/EventSubscriber/NavbarShowUserSubscriber.php @@ -54,6 +54,10 @@ class NavbarShowUserSubscriber implements EventSubscriberInterface */ public function onShowUser(ShowUserEvent $event) { + if ($this->storage->getToken() === null) { + return; + } + /* @var $myUser User */ $myUser = $this->storage->getToken()->getUser(); diff --git a/templates/bundles/TwigBundle/Exception/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig index 05c97565..d7bfe7b3 100644 --- a/templates/bundles/TwigBundle/Exception/error.html.twig +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -7,22 +7,33 @@ your application from some errors. See http://symfony.com/doc/current/cookbook/controller/error_pages.html #} + + + + + {{ 'http_error.title'|trans({}, 'exceptions') }}: {{ status_text }} + + -{% extends 'base.html.twig' %} +{% set errorTitleKey = "http_error_#{status_code}.description" %} +{% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} +{% if errorTitleKey == errorTitleTrans %} + {% set errorTitleKey = 'http_error.description' %} + {% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} +{% endif %} -{% block body_id 'error' %} +{% set errorMessageKey = "http_error_#{status_code}.suggestion" %} +{% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} +{% if errorMessageKey == errorMessageTrans %} + {% set errorMessageKey = 'http_error.suggestion' %} + {% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} +{% endif %} -{% block main %} -

{{ 'http_error.name'|trans({ '%status_code%': status_code }) }}

+

{{ errorTitleTrans }}

+

{{ status_code }}: {{ status_text }}

-

- {{ 'http_error.description'|trans({ '%status_code%': status_code }) }} -

-

- {{ 'http_error.suggestion'|trans({ '%url%': path('homepage') })|raw }} -

-{% endblock %} - -{% block sidebar %} - {{ parent() }} -{% endblock %} +
+ {{ errorMessageTrans }} +
+ + \ No newline at end of file diff --git a/templates/bundles/TwigBundle/Exception/error403.html.twig b/templates/bundles/TwigBundle/Exception/error403.html.twig index 9bd47cfd..dbc70bd1 100644 --- a/templates/bundles/TwigBundle/Exception/error403.html.twig +++ b/templates/bundles/TwigBundle/Exception/error403.html.twig @@ -1,28 +1,31 @@ -{# - This template is used to render errors of type HTTP 403 (Forbidden) - - This is the simplest way to customize error pages in Symfony applications. - In case you need it, you can also hook into the internal exception handling - made by Symfony. This allows you to perform advanced tasks and even recover - your application from some errors. - See http://symfony.com/doc/current/cookbook/controller/error_pages.html -#} - {% extends 'base.html.twig' %} - -{% block body_id 'error' %} +{% block page_title %}{{ 'http_error.title'|trans({}, 'exceptions') }}{% endblock %} +{% block page_subtitle %}{{ status_code }}{% endblock %} {% block main %} -

{{ 'http_error.name'|trans({ '%status_code%': 403 }) }}

+ {% set errorTitleKey = "http_error_#{status_code}.description" %} + {% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% if errorTitleKey == errorTitleTrans %} + {% set errorTitleKey = 'http_error.description' %} + {% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% endif %} -

- {{ 'http_error_403.description'|trans }} -

-

- {{ 'http_error_403.suggestion'|trans }} -

+ {% set errorMessageKey = "http_error_#{status_code}.suggestion" %} + {% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% if errorMessageKey == errorMessageTrans %} + {% set errorMessageKey = 'http_error.suggestion' %} + {% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% endif %} + +
+

{{ status_code }}

+ +
+

{{ errorTitleTrans }}

+

{{ errorMessageTrans }}

+
+
{% endblock %} -{% block sidebar %} - {{ parent() }} -{% endblock %} +{% block avanzu_control_sidebar %}{% endblock %} +{% block avanzu_navbar_control_sidebar_toggle %}{% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error404.html.twig b/templates/bundles/TwigBundle/Exception/error404.html.twig index 135e52a6..dbc70bd1 100644 --- a/templates/bundles/TwigBundle/Exception/error404.html.twig +++ b/templates/bundles/TwigBundle/Exception/error404.html.twig @@ -1,28 +1,31 @@ -{# - This template is used to render errors of type HTTP 404 (Not Found) - - This is the simplest way to customize error pages in Symfony applications. - In case you need it, you can also hook into the internal exception handling - made by Symfony. This allows you to perform advanced tasks and even recover - your application from some errors. - See http://symfony.com/doc/current/cookbook/controller/error_pages.html -#} - {% extends 'base.html.twig' %} - -{% block body_id 'error' %} +{% block page_title %}{{ 'http_error.title'|trans({}, 'exceptions') }}{% endblock %} +{% block page_subtitle %}{{ status_code }}{% endblock %} {% block main %} -

{{ 'http_error.name'|trans({ '%status_code%': 404 }) }}

+ {% set errorTitleKey = "http_error_#{status_code}.description" %} + {% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% if errorTitleKey == errorTitleTrans %} + {% set errorTitleKey = 'http_error.description' %} + {% set errorTitleTrans = errorTitleKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% endif %} -

- {{ 'http_error_404.description'|trans }} -

-

- {{ 'http_error_404.suggestion'|trans({ '%url%': path('homepage') })|raw }} -

+ {% set errorMessageKey = "http_error_#{status_code}.suggestion" %} + {% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% if errorMessageKey == errorMessageTrans %} + {% set errorMessageKey = 'http_error.suggestion' %} + {% set errorMessageTrans = errorMessageKey|trans({ '%status_code%': status_code }, 'exceptions') %} + {% endif %} + +
+

{{ status_code }}

+ +
+

{{ errorTitleTrans }}

+

{{ errorMessageTrans }}

+
+
{% endblock %} -{% block sidebar %} - {{ parent() }} -{% endblock %} +{% block avanzu_control_sidebar %}{% endblock %} +{% block avanzu_navbar_control_sidebar_toggle %}{% endblock %} diff --git a/templates/bundles/TwigBundle/Exception/error500.html.twig b/templates/bundles/TwigBundle/Exception/error500.html.twig index a3900645..01ed8b4b 100644 --- a/templates/bundles/TwigBundle/Exception/error500.html.twig +++ b/templates/bundles/TwigBundle/Exception/error500.html.twig @@ -7,22 +7,4 @@ your application from some errors. See http://symfony.com/doc/current/cookbook/controller/error_pages.html #} - -{% extends 'base.html.twig' %} - -{% block body_id 'error' %} - -{% block main %} -

{{ 'http_error.name'|trans({ '%status_code%': 500 }) }}

- -

- {{ 'http_error_500.description'|trans }} -

-

- {{ 'http_error_500.suggestion'|trans({ '%url%': path('homepage') })|raw }} -

-{% endblock %} - -{% block sidebar %} - {{ parent() }} -{% endblock %} +{% extends '@Twig/Exception/error.html.twig' %} diff --git a/translations/exceptions.de.xliff b/translations/exceptions.de.xliff index 300fe726..219a4512 100644 --- a/translations/exceptions.de.xliff +++ b/translations/exceptions.de.xliff @@ -6,6 +6,48 @@ access.denied Der Zugriff wurde verweigert + + stacktrace + Das Problem ist hier passiert + + + http_error.title + Fehler + + + http_error.description + Oops! Ein Fehler ist aufgetreten. + + + http_error.suggestion + + Ein unerwarteter Fehler ist aufgetreten. + Möglicherweise haben Sie einen Bug gefunden, daher kontaktieren Sie bitte ihren Administrator + wenn der Fehler nach einem erneuten Versuch immer noch vorhanden sein sollte. + + + + http_error_404.description + Oops! Seite wurde nicht gefunden. + + + http_error_404.suggestion + + Wir konnten die angeforderte Seite leider nicht finden. + Bitte wechseln Sie zurück zu ihrem Dashboard und starten von vorne. + + + + http_error_403.description + Diese Seite ist geschützt. + + + http_error_403.suggestion + + Entschuldigung, Sie haben nicht genügend Berechtigungen um diese Seite zu sehen. + Bitte sprechen Sie mit ihrem Administrator wenn Sie dies für einen Fehler halten. + + diff --git a/translations/exceptions.en.xliff b/translations/exceptions.en.xliff index e488b0c7..a6b84ad4 100644 --- a/translations/exceptions.en.xliff +++ b/translations/exceptions.en.xliff @@ -6,6 +6,48 @@ access.denied Access was denied + + stacktrace + The problem occured here + + + http_error.title + Error + + + http_error.description + Oops! An error occured. + + + http_error.suggestion + + An unexpected error occured, please try again. + You may have found a bug, so please contact your administrator if the problem + doesn't go away after you tried it again. + + + + http_error_404.description + Oops! Page not found. + + + http_error_404.suggestion + + We could not find the page you were looking for. + Meanwhile, you may return to your dashboard and start over. + + + + http_error_403.description + This page is restricted. + + + http_error_403.suggestion + + Sorry, but you do not have sufficient permissions to see this page. + Please talk to your administrator if you think this is an error. + +