diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index 8b93acfb..4995106c 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -13,3 +13,5 @@ twig: locale_menu: '%partdb.locale_menu%' attachment_manager: '@App\Services\Attachments\AttachmentManager' label_profile_dropdown_helper: '@App\Services\LabelSystem\LabelProfileDropdownHelper' + error_page_admin_email: '%partdb.error_pages.admin_email%' + error_page_show_help: '%partdb.error_pages.show_help%' diff --git a/config/parameters.yaml b/config/parameters.yaml index e038203b..ec9128a7 100644 --- a/config/parameters.yaml +++ b/config/parameters.yaml @@ -33,6 +33,12 @@ parameters: partdb.attachments.dir.media: 'public/media/' # The folder where uploaded attachment files are saved (must be in public folder) partdb.attachments.dir.secure: 'uploads/' # The folder where secured attachment files are saved (must not be in public/) + ###################################################################################################################### + # Error pages + ###################################################################################################################### + partdb.error_pages.admin_email: '' # You can set an email address here, which is shown on an error page, how to contact an administrator + partdb.error_pages.show_help: false # If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them... + ###################################################################################################################### # Miscellaneous ###################################################################################################################### diff --git a/templates/bundles/TwigBundle/Exception/assets/error.css.twig b/templates/bundles/TwigBundle/Exception/assets/error.css.twig new file mode 100644 index 00000000..0d0a1be6 --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/assets/error.css.twig @@ -0,0 +1,95 @@ +body { + background-color: #fff; + color: #222; + font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + margin: 0; +} +.container { + padding: 50px; + width: 100%; + box-sizing: border-box; +} + +h1 { + margin-top: 10px; + color: #dc3545; + font-size: 24px; +} +h2 { + font-size: 18px; +} + +.status_code { + text-align: center; + + font-size: 72px; + line-height: 0.5; +} + +.status_text { + text-align: center; + line-height: 0.5; + font-size: 32px; +} + +.status_comment { + text-align: center; + line-height: 1; +} + +.help_text { + text-align: center; + font-size: 18px; +} + +.text-muted { + color: #6c757d!important; +} + +.text-center { + text-align: center; +} + +ul { + display: table; + margin: 10px auto; + line-height: 1.4; + text-align: left; +} + +.footer { + box-sizing: border-box; + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + line-height: 1.2; + text-align: left; + padding-top: 15px; + padding-left: 30px; + background-color: #f5f5f5; +} + +.dev_hint { + margin-top: 45px; + line-height: 0.5; + text-align: center; +} + +code { + font-size: 87.5%; + color: #e83e8c; + word-break: break-word; +} + +code, kbd, pre, samp { + font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace; +} + +kbd { + padding: .2rem .4rem; + font-size: 87.5%; + color: #fff; + background-color: #212529; + border-radius: .2rem; +} \ No newline at end of file diff --git a/templates/bundles/TwigBundle/Exception/error.html.twig b/templates/bundles/TwigBundle/Exception/error.html.twig new file mode 100644 index 00000000..ea9b5849 --- /dev/null +++ b/templates/bundles/TwigBundle/Exception/error.html.twig @@ -0,0 +1,53 @@ + + +
+ + + +You can try to Go Back or Visit the homepage.
{% endblock %} + {% block admin_contact %}If this error persists, please contact your + {% if error_page_admin_email is not empty %} + administrator. + {% else %} + administrator. + {% endif %} +
+ {% endblock %} + + {% if error_page_show_help %} +var/log/prod.log
for additional informationsIf you think that this is an error in Part-DB, open an Issue on GitHub.
+You can disable these hints in config/parameters.yaml
by setting partdb.error_pages.show_help
to false.
DATABASE_URL
in .env.local
is correct: database name, user and password must be correct.var/log/prod.log
for additional informations