Add ThemeBundle exception page

pull/2487/head
jmontoyaa 8 years ago
parent 789f3b2df0
commit 4be18b3e0e
  1. 7
      src/ThemeBundle/Controller/ExceptionController.php
  2. 5
      src/ThemeBundle/DependencyInjection/ChamiloThemeExtension.php
  3. 13
      src/ThemeBundle/Resources/config/services.xml
  4. 18
      src/ThemeBundle/Resources/config/services.yaml
  5. 11
      src/ThemeBundle/Resources/views/Exception/error.html.twig
  6. 11
      src/ThemeBundle/Resources/views/Exception/error404.html.twig
  7. 83
      src/ThemeBundle/Resources/views/Exception/exception_full.html.twig
  8. 3
      src/ThemeBundle/Resources/views/Layout/base-layout.html.twig
  9. 1
      templates/bundles/TwigBundle/Exception/error404.html.twig

@ -23,10 +23,15 @@ class ExceptionController extends BaseExceptionController
*/
protected function findTemplate(Request $request, $format, $code, $debug)
{
if (strpos($request->getPathInfo(), '/admin') !== 0) {
// Only show custom error when APP_DEBUG = 0
if ($debug) {
return parent::findTemplate($request, $format, $code, $debug);
}
/*if (strpos($request->getPathInfo(), '/admin') !== 0) {
return parent::findTemplate($request, $format, $code, $debug);
}*/
$name = $debug ? 'exception' : 'error';
if ($debug && 'html' == $format) {
$name = 'exception_full';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\ThemeBundle\DependencyInjection;
@ -20,8 +21,8 @@ class ChamiloThemeExtension extends Extension implements PrependExtensionInterfa
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yaml');
}
/**

@ -33,12 +33,13 @@
<argument>%chamilo_admin_theme.dependency_resolver.class%</argument>
</service>
<!--<service id="chamilo_admin_theme.setup_theme_listener" class="%chamilo_admin_theme.setup_theme_listener.class%">-->
<!--<argument type="service" id="chamilo_admin_theme.theme_manager"/>-->
<!--<argument>%chamilo_admin_theme.css_base%</argument>-->
<!--<argument>%chamilo_admin_theme.lte_admin%</argument>-->
<!--<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />-->
<!--</service>-->
<service id="chamilo_admin_theme.setup_theme_listener" class="%chamilo_admin_theme.setup_theme_listener.class%">
<argument type="service" id="chamilo_admin_theme.theme_manager"/>
<argument>%chamilo_admin_theme.css_base%</argument>
<argument>%chamilo_admin_theme.lte_admin%</argument>
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
</service>
<service id="chamilo_admin_theme.context_listener" class="Chamilo\ThemeBundle\EventListener\ContextListener">
<argument type="service" id="service_container" />
<tag name="kernel.event_listener" event="kernel.request" method="onRequest" />

@ -0,0 +1,18 @@
services:
_defaults:
autowire: true
Chamilo\ThemeBundle\Controller\ExceptionController:
public: true
arguments:
$twig: '@twig'
$debug: '%kernel.debug%'
chamilo_theme_widget_extension:
class: 'Chamilo\ThemeBundle\Twig\WidgetExtension'
tags:
- 'twig.extension'
# chamilo_theme.context_listener:
# class:

@ -0,0 +1,11 @@
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %}
{% block page_title %} Error {% endblock %}
{% block page_subtitle %} {{ status_code }} {% endblock %}
{% block page_content %}
<div class="error-page">
<h2 class="headline">{{ status_code }}</h2>
<div class="error-content">
<h3>{{ 'Something seems to have gone wrong'|trans() }}</h3>
</div>
</div>
{% endblock %}

@ -0,0 +1,11 @@
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %}
{% block page_title %} Error {% endblock %}
{% block page_subtitle %} {{ status_code }} {% endblock %}
{% block page_content %}
<div class="error-page">
<h2 class="headline">{{ status_code }}</h2>
<div class="error-content">
<h3>{{ 'Page not found'|trans() }}</h3>
</div>
</div>
{% endblock %}

@ -1,94 +1,11 @@
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %}
{% block page_title %} Error {% endblock %}
{% block page_subtitle %} {{ status_code }} {% endblock %}
{% block page_content %}
<div class="error-page">
<h2 class="headline">{{ status_code }}</h2>
<div class="error-content">
<h3>{{ 'Something seems to have gone wrong'|trans() }}</h3>
<p>{{ exception.message }}</p>
</div>
</div>
<div class="">
{% for n, position in exception.toarray %}
<div class="box box-danger">
<div class="box-header">
<i class="fa fa-warning"></i>
<h3 class="box-title">{{ position.class|abbr_class }}</h3>
</div>
<div class="box-body">
<div class="callout callout-danger">
{{ position.message|nl2br|format_file_from_text }}
</div>
<div class="box-group" id="box-{{ n }}">
<!-- trace -->
<div class="panel box box-warning">
<div class="box-header">
<h4 class="box-title">
<a data-toggle="collapse" data-parent="box-{{ n }}"
href="#trace-{{ n }}">
{{ 'Stack Trace'|trans() }}
</a>
</h4>
</div>
<div id="trace-{{ n }}" class="panel-collapse collapse">
<div class="box-body">
<div class="panel">
<ul class="timeline">
{% for i, trace in position.trace %}
<li class="time-label">
<span class="bg-red">
Stack #{{ i }}
</span>
</li>
<li>
<i class="fa fa-code bg-blue"></i>
<div class="timeline-item">
<h3 class="timeline-header">
{{ trace.file }}
</h3>
<div class="timeline-body">
{% if trace.function %}
at
<strong>
<abbr title="{{ trace.class }}">{{ trace.short_class }}</abbr>
{{ trace.type ~ trace.function }}
</strong>
({{ trace.args|format_args }})
{% endif %}
{% if trace.file is defined and trace.file and trace.line is defined and trace.line %}
{{ trace.function ? '<br />' : '' }}
in {{ trace.file|format_file(trace.line) }}&nbsp;
{{ trace.file|file_excerpt(trace.line) }}
{% endif %}
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endblock %}

@ -24,7 +24,7 @@
<link href="https://chamilo.org/the-association/" rel="author"/>
<link href="https://chamilo.org/the-association/" rel="copyright"/>
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}"/>
<link rel="icon" type="image/x-icon" href="{{ asset('build/css/themes/'~ theme ~'/favicon.ico') }}"/>
<link rel="icon" type="image/x-icon" href="{{ asset('build/css/themes/'~ theme ~'/favicon.ico') }}"/>julio
<title>
{% block title %}
{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }}
@ -60,7 +60,6 @@
<script src="{{ asset('build/chamilo.js') }}"></script>
<script src="{{ asset('libs/ckeditor/ckeditor.js') }}"></script>
<script src="{{ asset('libs/readmore-js/readmore.min.js') }}"></script>
{#<script src="{{ asset('assets/modernizr/modernizr.js') }}"></script>#}
{# Check chamilo_js key in assetic.yml #}

Loading…
Cancel
Save